profile.c File Reference

Simple profiling subsystem. More...

#include "ctl/profile.h"
#include <stdio.h>

Include dependency graph for profile.c:

Go to the source code of this file.

Functions

void ctl_profiles_dump (void)
 Dump profile information Does not print anything if there were ne profiles.
void ctl_profiles_global_reset (void)
 Run through all profilers and tell them they've never been called.
void ctl_profile_init (ctl_profile *self, const char *label)
 Add a profiler to the list and innitialize it.
void ctl_profiles_dump_averages_sheet (void)
 Dump profile 'averages' in spreadsheet format Does not print anything if there were ne profiles.
void ctl_profile_average_init (ctl_profile_average *self, const char *label)
 Add an averaging profiler to the list and initialize it.
void ctl_profile_counter_init (ctl_profile_counter *self, const char *label, mstime window)
 Add a counting profiler (i.e. frames per second) to the list and initialize it.
void ctl_profile_testpoint_init (ctl_profile_testpoint *self, const char *label)
 Add a test point (i.e. size of pool) to the list and initialize it.


Detailed Description

Simple profiling subsystem.

Author:
David Mace

Definition in file profile.c.


Function Documentation

void ctl_profile_average_init ( ctl_profile_average self,
const char *  label 
)

Add an averaging profiler to the list and initialize it.

Parameters:
self instance to init
label What to call it

Definition at line 140 of file profile.c.

References ctl_profile_init().

00141 {
00142     ctl_profile_init( &self->profile, label );
00143     self->profile.type = ctl_profile_type_average;
00144     self->profile.print = ctl_profile_average_print;
00145     self->total = self->max = 0;
00146     self->min = int64_max;
00147     self->count = 0;
00148 }

Here is the call graph for this function:

void ctl_profile_counter_init ( ctl_profile_counter self,
const char *  label,
mstime  window 
)

Add a counting profiler (i.e. frames per second) to the list and initialize it.

Parameters:
self instance to init
label What to call it
window How often to self-reset; 0 if never

Definition at line 165 of file profile.c.

References ctl_profile_init(), and ctl_ustime().

00166 {
00167     ctl_profile_init( &self->profile, label );
00168     self->profile.type = ctl_profile_type_counter;
00169     self->profile.print = ctl_profile_counter_print;
00170     self->window = window;
00171     self->began = self->last = ctl_ustime();
00172     self->count = 0;
00173 }

Here is the call graph for this function:

void ctl_profile_init ( ctl_profile self,
const char *  label 
)

Add a profiler to the list and innitialize it.

Parameters:
self instance to init
label What to call it

Definition at line 65 of file profile.c.

Referenced by ctl_profile_average_init(), ctl_profile_counter_init(), and ctl_profile_testpoint_init().

00066 {
00067     self->label = label;
00068     self->type = ctl_profile_type_profile;
00069     self->print = ctl_profile_print;
00070     self->usPrev = -1;
00071     self->usCurr = -1;
00072     /* Push onto head of profile list */
00073     self->next = ctl_profile_list;
00074     ctl_profile_list = self;
00075 }

void ctl_profile_testpoint_init ( ctl_profile_testpoint self,
const char *  label 
)

Add a test point (i.e. size of pool) to the list and initialize it.

Parameters:
self instance to init
label What to call it
window How often to self-reset; 0 if never

Definition at line 189 of file profile.c.

References ctl_profile_init().

00190 {
00191     ctl_profile_init( &self->profile, label );
00192     self->count = 0;
00193     self->value = 0;
00194     self->min = int64_max;
00195     self->max = int64_min;
00196     self->profile.type = ctl_profile_type_testpoint;
00197     self->profile.print = ctl_profile_testpoint_print;
00198 }

Here is the call graph for this function:


Generated on Fri Jan 2 15:28:35 2009 for Squat by  doxygen 1.5.6