FS2_Open
Open source remastering of the Freespace 2 engine
profiling.cpp File Reference
#include "cmdline/cmdline.h"
#include "globalincs/pstypes.h"
#include "globalincs/systemvars.h"
#include "io/timer.h"
#include <fstream>

Go to the source code of this file.

Functions

void profile_init ()
 Called once at engine initialization to set the timer. More...
 
void profile_deinit ()
 
void profile_begin (const char *name)
 
void profile_end (const char *name)
 
void profile_dump_output ()
 
void store_profile_in_history (SCP_string &name, float percent, uint time)
 
void get_profile_from_history (SCP_string &name, float *avg, float *min, float *max, uint *avg_micro_sec, uint *min_micro_sec, uint *max_micro_sec)
 

Variables

SCP_vector< profile_samplesamples
 
SCP_vector< profile_sample_historyhistory
 
uint start_profile_time = 0
 
uint end_profile_time = 0
 
SCP_string profile_output
 
std::ofstream profiling_file
 

Function Documentation

void get_profile_from_history ( SCP_string name,
float avg,
float min,
float max,
uint avg_micro_sec,
uint min_micro_sec,
uint max_micro_sec 
)

Gets the min, max and average values for a given profile

Parameters
nameThe globally unique name for this profile (see profile_begin()/profile_end())
avgPointer to a float in which the average value will be stored (or 0.0 if no value has been saved)
minPointer to a float in which the minimum value will be stored (or 0.0 if no value has been saved)
maxPointer to a float in which the maximum value will be stored (or 0.0 if no value has been saved)

Definition at line 326 of file profiling.cpp.

void profile_begin ( const char *  name)

Used to start profiling a section of code. A section started by profile_begin needs to be closed off by calling profile_end with the same argument.

Parameters
nameA globally unique string that will be displayed in the HUD readout

Definition at line 80 of file profiling.cpp.

void profile_deinit ( )

Definition at line 63 of file profiling.cpp.

void profile_dump_output ( )

Builds the output text.

Definition at line 196 of file profiling.cpp.

void profile_end ( const char *  name)

Used to end profiling of a section of code. Note that the parameter given MUST match that of the preceding call to profile_begin

Parameters
nameA globally unique string that will be displayed in the HUD readout

Definition at line 130 of file profiling.cpp.

void profile_init ( )

Called once at engine initialization to set the timer.

Definition at line 48 of file profiling.cpp.

void store_profile_in_history ( SCP_string name,
float  percent,
uint  time 
)

Stores profile data in in the profile history lookup. This is used internally by the profiling code and should not be called outside of it.

Parameters
nameThe globally unique name for this profile (see profile_begin()/profile_end())
percentHow much time the profiled section took to execute (as a percentage of overall frametime)

Definition at line 263 of file profiling.cpp.

Variable Documentation

uint end_profile_time = 0

Definition at line 40 of file profiling.cpp.

Definition at line 37 of file profiling.cpp.

SCP_string profile_output

Definition at line 42 of file profiling.cpp.

std::ofstream profiling_file

Definition at line 43 of file profiling.cpp.

Definition at line 36 of file profiling.cpp.

uint start_profile_time = 0

Definition at line 39 of file profiling.cpp.