FreeSWITCH API Documentation  1.7.0
Typedefs | Functions
switch_profile.h File Reference
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

typedef struct profile_timer switch_profile_timer_t
 

Functions

switch_profile_timer_tswitch_new_profile_timer (void)
 create a new profile timer More...
 
switch_bool_t switch_get_system_idle_time (switch_profile_timer_t *p, double *idle_percentage)
 provides the percentage of idle system time More...
 
void switch_delete_profile_timer (switch_profile_timer_t **p)
 Deletes profile timer. More...
 

Typedef Documentation

Definition at line 37 of file switch_profile.h.

Function Documentation

void switch_delete_profile_timer ( switch_profile_timer_t **  p)

Deletes profile timer.

Definition at line 324 of file switch_profile.c.

Referenced by SWITCH_MODULE_RUNTIME_FUNCTION().

325 {
326  if (!p) return;
327 
328 #ifdef __linux__
329  close((*p)->procfd);
330 #endif
331  free((*p)->percentage_of_idle_time_ring);
332  free(*p);
333  *p = NULL;
334 }
switch_bool_t switch_get_system_idle_time ( switch_profile_timer_t p,
double *  idle_percentage 
)

provides the percentage of idle system time

Parameters
pprofile timer structure previously created with new_profile_timer
pointerto store the percentage of idle time
Returns
false on error true for success
Note
on error idle_percentage will be set to 100

Definition at line 296 of file switch_profile.c.

References SWITCH_FALSE.

Referenced by SWITCH_MODULE_RUNTIME_FUNCTION().

297 {
298  *idle_percentage = 100.0;
299  return SWITCH_FALSE;
300 }
switch_profile_timer_t* switch_new_profile_timer ( void  )

create a new profile timer

Returns
profile timer structure previously created with new_profile_timer, NULL on error

Definition at line 304 of file switch_profile.c.

References profile_timer::cpu_idle_smoothing_depth, switch_runtime::cpu_idle_smoothing_depth, profile_timer::percentage_of_idle_time_ring, and runtime.

Referenced by SWITCH_MODULE_RUNTIME_FUNCTION().

305 {
306  unsigned int x;
307  switch_profile_timer_t *p = calloc(1, sizeof(switch_profile_timer_t));
308 
311  } else {
312  p->cpu_idle_smoothing_depth = 30;
313  }
314 
315  p->percentage_of_idle_time_ring = calloc(1, sizeof(double) * p->cpu_idle_smoothing_depth);
316 
317  for ( x = 0; x < p->cpu_idle_smoothing_depth; x++ ) {
318  p->percentage_of_idle_time_ring[x] = 100.0;
319  }
320 
321  return p;
322 }
struct switch_runtime runtime
Definition: switch_core.c:64
unsigned int cpu_idle_smoothing_depth
double * percentage_of_idle_time_ring
uint32_t cpu_idle_smoothing_depth