PAPI  5.3.2.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cost_utils.c File Reference
Include dependency graph for cost_utils.c:

Go to the source code of this file.

Functions

double do_stats (long long *array, long long *min, long long *max, double *average)
 
void do_std_dev (long long *a, int *s, double std, double ave)
 
void do_dist (long long *a, long long min, long long max, int bins, int *d)
 

Variables

int num_iters = NUM_ITERS
 

Function Documentation

void do_dist ( long long a,
long long  min,
long long  max,
int  bins,
int d 
)

Definition at line 51 of file cost_utils.c.

52 {
53  int i, j;
54  int dmax = 0;
55  int range = ( int ) ( max - min + 1 ); /* avoid edge conditions */
56 
57  /* clear the distribution array */
58  for ( i = 0; i < bins; i++ ) {
59  d[i] = 0;
60  }
61 
62  /* scan the array to distribute cost per bin */
63  for ( i = 0; i < num_iters; i++ ) {
64  j = ( ( int ) ( a[i] - min ) * bins ) / range;
65  d[j]++;
66  if ( j && ( dmax < d[j] ) )
67  dmax = d[j];
68  }
69 
70  /* scale each bin to a max of 100 */
71  for ( i = 1; i < bins; i++ ) {
72  d[i] = ( d[i] * 100 ) / dmax;
73  }
74 }
off64_t max
Definition: libasync.c:331
volatile int num_iters
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: rapl_basic.c:37
int i
Definition: fileop.c:140
#define min(x, y)
Definition: darwin-common.h:4
int range
Definition: fileop.c:139
int
Definition: iozone.c:18528
long j
Definition: iozone.c:19135

Here is the caller graph for this function:

double do_stats ( long long array,
long long min,
long long max,
double average 
)

Definition at line 7 of file cost_utils.c.

8 {
9  int i;
10  double std, tmp;
11 
12  *min = *max = array[0];
13  *average = 0;
14  for ( i = 0; i < num_iters; i++ ) {
15  *average += ( double ) array[i];
16  if ( *min > array[i] )
17  *min = array[i];
18  if ( *max < array[i] )
19  *max = array[i];
20  }
21  *average = *average / ( double ) num_iters;
22  std = 0;
23  for ( i = 0; i < num_iters; i++ ) {
24  tmp = ( double ) array[i] - ( *average );
25  std += tmp * tmp;
26  }
27  std = sqrt( std / ( num_iters - 1 ) );
28  return ( std );
29 }
off64_t max
Definition: libasync.c:331
volatile int num_iters
static double
Definition: fileop.c:1281
int i
Definition: fileop.c:140
#define min(x, y)
Definition: darwin-common.h:4
long long tmp
Definition: iozone.c:12031

Here is the caller graph for this function:

void do_std_dev ( long long a,
int s,
double  std,
double  ave 
)

Definition at line 32 of file cost_utils.c.

33 {
34  int i, j;
35  double dev[10];
36 
37  for ( i = 0; i < 10; i++ ) {
38  dev[i] = std * ( i + 1 );
39  s[i] = 0;
40  }
41 
42  for ( i = 0; i < num_iters; i++ ) {
43  for ( j = 0; j < 10; j++ ) {
44  if ( ( ( double ) a[i] - dev[j] ) > ave )
45  s[j]++;
46  }
47  }
48 }
volatile int num_iters
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: rapl_basic.c:37
int i
Definition: fileop.c:140
s
Definition: iozone.c:20289
long j
Definition: iozone.c:19135

Here is the caller graph for this function:

Variable Documentation

int num_iters = NUM_ITERS

Definition at line 3 of file cost_utils.c.