PAPI  5.0.1.0
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 51 of file cost_utils.c.

{
    int i, j;
    int dmax = 0;
    int range = ( int ) ( max - min + 1 );  /* avoid edge conditions */

    /* clear the distribution array */
    for ( i = 0; i < bins; i++ ) {
        d[i] = 0;
    }

    /* scan the array to distribute cost per bin */
    for ( i = 0; i < num_iters; i++ ) {
        j = ( ( int ) ( a[i] - min ) * bins ) / range;
        d[j]++;
        if ( j && ( dmax < d[j] ) )
            dmax = d[j];
    }

    /* scale each bin to a max of 100 */
    for ( i = 1; i < bins; i++ ) {
        d[i] = ( d[i] * 100 ) / dmax;
    }
}

Here is the caller graph for this function:

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

Definition at line 7 of file cost_utils.c.

{
    int i;
    double std, tmp;

    *min = *max = array[0];
    *average = 0;
    for ( i = 0; i < num_iters; i++ ) {
        *average += ( double ) array[i];
        if ( *min > array[i] )
            *min = array[i];
        if ( *max < array[i] )
            *max = array[i];
    }
    *average = *average / ( double ) num_iters;
    std = 0;
    for ( i = 0; i < num_iters; i++ ) {
        tmp = ( double ) array[i] - ( *average );
        std += tmp * tmp;
    }
    std = sqrt( std / ( num_iters - 1 ) );
    return ( std );
}

Here is the caller graph for this function:

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

Definition at line 32 of file cost_utils.c.

{
    int i, j;
    double dev[10];

    for ( i = 0; i < 10; i++ ) {
        dev[i] = std * ( i + 1 );
        s[i] = 0;
    }

    for ( i = 0; i < num_iters; i++ ) {
        for ( j = 0; j < 10; j++ ) {
            if ( ( ( double ) a[i] - dev[j] ) > ave )
                s[j]++;
        }
    }
}

Here is the caller graph for this function:


Variable Documentation

int num_iters

Definition at line 11 of file ctests/locks_pthreads.c.

 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines