PAPI 7.1.0.0
Loading...
Searching...
No Matches
caches.h
Go to the documentation of this file.
1#ifndef _CACHES_
2#define _CACHES_
3
4#include <stdio.h>
5#include <unistd.h>
6#include <stdlib.h>
7#include <string.h>
8#include <sys/time.h>
9#include <assert.h>
10// Header files for uintptr_t
11#if defined (__SVR4) && defined (__sun)
12# include <sys/types.h>
13#else
14# include <stdint.h>
15#endif
16#include <unistd.h>
17
18// Header files for setting the affinity
19#if defined(__linux__)
20# define __USE_GNU 1
21# include <sched.h>
22#elif defined (__SVR4) && defined (__sun)
23//#elif defined(__sparc)
24# include <sys/types.h>
25# include <sys/processor.h>
26# include <sys/procset.h>
27#endif
28
29#include <pthread.h>
30
31#define SIZE (512*1024)
32
33#define L_SIZE 0
34#define C_SIZE 1
35#define ASSOC 2
36
37//#define DEBUG
38
39#define MAXTHREADS 128
40typedef struct run_output_s{
41 double dt[MAXTHREADS];
42 double counter[MAXTHREADS];
43 int status;
45
46static inline double getticks(void){
47 double ret;
48 struct timeval tv;
49
50 gettimeofday(&tv, NULL);
51 ret = 1000*1000*(double)tv.tv_sec + (double)tv.tv_usec;
52 return ret;
53}
54
55static inline double elapsed(double t1, double t0){
56 return (double)t1 - (double)t0;
57}
58
59extern int compar_lf(const void *a, const void *b);
60extern int compar_lld(const void *a, const void *b);
61
62#endif
int compar_lf(const void *a, const void *b)
Definition: compar.c:1
static double elapsed(double t1, double t0)
Definition: caches.h:55
static double getticks(void)
Definition: caches.h:46
#define MAXTHREADS
Definition: caches.h:39
int compar_lld(const void *a, const void *b)
Definition: compar.c:9
volatile double t1
static double a[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:38
static double b[MATRIX_SIZE][MATRIX_SIZE]
Definition: libmsr_basic.c:39
int status
Definition: caches.h:43
__time_t tv_sec
__suseconds_t tv_usec