PIPS
perf_spy.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/resource.h>
#include "genC.h"
#include "misc.h"
+ Include dependency graph for perf_spy.c:

Go to the source code of this file.

Macros

#define USAGE_STACK_SIZE   10
 for USAGE information More...
 

Functions

static void printf_time (FILE *f, struct timeval *p)
 available bucket More...
 
static void printf_time_delta (FILE *f, struct timeval *begin, struct timeval *end)
 
static void printf_usage_delta (FILE *f, struct rusage *begin, struct rusage *end)
 simply dump all available information... More...
 
void push_performance_spy ()
 perf_spy.c More...
 
void pop_performance_spy (FILE *f, string msg)
 

Variables

static struct rusage usage_stack [USAGE_STACK_SIZE]
 
static int stack_index = 0
 

Macro Definition Documentation

◆ USAGE_STACK_SIZE

#define USAGE_STACK_SIZE   10

for USAGE information

Definition at line 43 of file perf_spy.c.

Function Documentation

◆ pop_performance_spy()

void pop_performance_spy ( FILE *  f,
string  msg 
)
Parameters
msgsg

Definition at line 97 of file perf_spy.c.

100 {
101  struct rusage current;
102  message_assert("stack not empty", stack_index>0);
103  fprintf(f, "[performance_spy] %s\n", msg);
104 
105  getrusage(RUSAGE_SELF, &current);
106  fprintf(f, "self:\n");
108  fprintf(f, "children:\n");
109  getrusage(RUSAGE_CHILDREN, &current);
111 }
#define message_assert(msg, ex)
Definition: newgen_assert.h:47
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
static void printf_usage_delta(FILE *f, struct rusage *begin, struct rusage *end)
simply dump all available information...
Definition: perf_spy.c:70
static struct rusage usage_stack[USAGE_STACK_SIZE]
Definition: perf_spy.c:44
static int stack_index
Definition: perf_spy.c:45
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
static size_t current
Definition: string.c:115

References current, f(), fprintf(), message_assert, printf_usage_delta(), stack_index, and usage_stack.

Referenced by hpf_remapping().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printf_time()

static void printf_time ( FILE *  f,
struct timeval *  p 
)
static

available bucket

Definition at line 48 of file perf_spy.c.

51 {
52  fprintf(f, "%.3f", (double) p->tv_sec + (double) p->tv_usec/1e6);
53 }

References f(), and fprintf().

Referenced by printf_time_delta(), and printf_usage_delta().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printf_time_delta()

static void printf_time_delta ( FILE *  f,
struct timeval *  begin,
struct timeval *  end 
)
static

Definition at line 56 of file perf_spy.c.

60 {
61  struct timeval delta;
62  delta.tv_sec = end->tv_sec - begin->tv_sec;
63  delta.tv_usec = end->tv_usec - begin->tv_usec;
64  printf_time(f, &delta);
65 }
char end
Definition: gtk_status.c:82
static void printf_time(FILE *f, struct timeval *p)
available bucket
Definition: perf_spy.c:48

References end, f(), and printf_time().

Referenced by printf_usage_delta().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ printf_usage_delta()

static void printf_usage_delta ( FILE *  f,
struct rusage *  begin,
struct rusage *  end 
)
static

simply dump all available information...

Definition at line 70 of file perf_spy.c.

74 {
75  fprintf(f, " user: ");
76  printf_time_delta(f, &begin->ru_utime, &end->ru_utime);
77  fprintf(f, "/");
78  printf_time(f, &end->ru_utime);
79  fprintf(f, "s syst: ");
80  printf_time_delta(f, &begin->ru_stime, &end->ru_stime);
81  fprintf(f, "/");
82  printf_time(f, &end->ru_stime);
83  fprintf(f, "s\n page faults major: %ld/%ld minor: %ld/%ld\n",
84  end->ru_majflt-begin->ru_majflt, end->ru_majflt,
85  end->ru_minflt-begin->ru_minflt, end->ru_minflt);
86 }
static void printf_time_delta(FILE *f, struct timeval *begin, struct timeval *end)
Definition: perf_spy.c:56

References end, f(), fprintf(), printf_time(), and printf_time_delta().

Referenced by pop_performance_spy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ push_performance_spy()

void push_performance_spy ( void  )

perf_spy.c

Definition at line 89 of file perf_spy.c.

90 {
91  message_assert("stack not full", stack_index<USAGE_STACK_SIZE);
92  getrusage(RUSAGE_CHILDREN, &usage_stack[stack_index++]);
93  getrusage(RUSAGE_SELF, &usage_stack[stack_index++]);
94 }
#define USAGE_STACK_SIZE
for USAGE information
Definition: perf_spy.c:43

References message_assert, stack_index, usage_stack, and USAGE_STACK_SIZE.

Referenced by hpf_remapping().

+ Here is the caller graph for this function:

Variable Documentation

◆ stack_index

int stack_index = 0
static

Definition at line 45 of file perf_spy.c.

Referenced by pop_performance_spy(), and push_performance_spy().

◆ usage_stack

struct rusage usage_stack[USAGE_STACK_SIZE]
static

Definition at line 1 of file perf_spy.c.

Referenced by pop_performance_spy(), and push_performance_spy().