PAPI  5.6.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
cost_utils.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

double do_stats (long long *, long long *, long long *, double *)
 
void do_std_dev (long long *, int *, double, double)
 
void do_dist (long long *, long long, long long, int, int *)
 

Variables

int num_iters
 

Function Documentation

void do_dist ( long long ,
long  long,
long  long,
int  ,
int  
)

Definition at line 54 of file cost_utils.c.

55 {
56  int i, j;
57  int dmax = 0;
58  int range = ( int ) ( max - min + 1 ); /* avoid edge conditions */
59 
60  /* clear the distribution array */
61  for ( i = 0; i < bins; i++ ) {
62  d[i] = 0;
63  }
64 
65  /* scan the array to distribute cost per bin */
66  for ( i = 0; i < num_iters; i++ ) {
67  j = ( ( int ) ( a[i] - min ) * bins ) / range;
68  d[j]++;
69  if ( j && ( dmax < d[j] ) )
70  dmax = d[j];
71  }
72 
73  /* scale each bin to a max of 100 */
74  for ( i = 1; i < bins; i++ ) {
75  d[i] = ( d[i] * 100 ) / dmax;
76  }
77 }
off64_t max
Definition: libasync.c:331
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
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:38
int num_iters
Definition: cost_utils.c:6

Here is the caller graph for this function:

double do_stats ( long long ,
long long ,
long long ,
double  
)

Definition at line 10 of file cost_utils.c.

11 {
12  int i;
13  double std, tmp;
14 
15  *min = *max = array[0];
16  *average = 0;
17  for ( i = 0; i < num_iters; i++ ) {
18  *average += ( double ) array[i];
19  if ( *min > array[i] )
20  *min = array[i];
21  if ( *max < array[i] )
22  *max = array[i];
23  }
24  *average = *average / ( double ) num_iters;
25  std = 0;
26  for ( i = 0; i < num_iters; i++ ) {
27  tmp = ( double ) array[i] - ( *average );
28  std += tmp * tmp;
29  }
30  std = sqrt( std / ( num_iters - 1 ) );
31  return ( std );
32 }
off64_t max
Definition: libasync.c:331
static double array[ARRAYSIZE]
Definition: papi_l1_dca.c:23
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
int num_iters
Definition: cost_utils.c:6

Here is the caller graph for this function:

void do_std_dev ( long long ,
int ,
double  ,
double   
)

Definition at line 35 of file cost_utils.c.

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

Here is the caller graph for this function:

Variable Documentation

int num_iters

Definition at line 6 of file cost_utils.c.