Commit 9e448a20 authored by Martin Perdacher's avatar Martin Perdacher

removed l1 cache measure

parent db561393
......@@ -2,59 +2,57 @@
#include "papicalls.h"
PapiBin::PapiBin(){
int num_hwcntrs;
if ((num_hwcntrs = PAPI_num_counters()) < 0 ){
if ((num_hwcntrs = PAPI_num_counters()) < NUM_EVENTS ){
fprintf(stderr,"Info:: This installation does not support PAPI: %s\n", PAPI_strerror(num_hwcntrs));
exit(1);
}
}
if ((num_hwcntrs = PAPI_num_counters()) < NUM_EVENTS ){
fprintf(stderr,"Info:: This machine does not provide sufficient hardware counters.\n");
exit(1);
}
// int num_hwcntrs;
// if ((num_hwcntrs = PAPI_num_counters()) < 0 ){
// if ((num_hwcntrs = PAPI_num_counters()) < NUM_EVENTS ){
// fprintf(stderr,"Info:: This installation does not support PAPI: %s\n", PAPI_strerror(num_hwcntrs));
// exit(1);
// }
// }
//
// if ((num_hwcntrs = PAPI_num_counters()) < NUM_EVENTS ){
// fprintf(stderr,"Info:: This machine does not provide sufficient hardware counters.\n");
// exit(1);
// }
}
void PapiBin::start(){
int retval=0;
counters.l1 = 0; // counters.l2 = 0; counters.l3 = 0;
// counters.l1 = 0; // counters.l2 = 0; counters.l3 = 0;
// counters.rtime = 0.0; counters.ptime = 0.0; counters.flops = 0; counters.mflops;
// if ( ( retval = PAPI_flops( &counters.rtime, &counters.ptime, &counters.flops, &counters.mflops ) ) < PAPI_OK ){
// fprintf(stderr,"Call to PAPI_flops failed: %s\n", PAPI_strerror(retval));
// exit(1);
// }
energy_consume.reset(); energy_consume.start();
timer.start();
if ((retval = PAPI_start_counters(events, NUM_EVENTS)) < PAPI_OK) {
fprintf(stderr, "PAPI failed to start counters: %s\n", PAPI_strerror(retval));
exit(1);
}
// if ((retval = PAPI_start_counters(events, NUM_EVENTS)) < PAPI_OK) {
// fprintf(stderr, "PAPI failed to start counters: %s\n", PAPI_strerror(retval));
// exit(1);
// }
}
void PapiBin::stop(){
int retval=0;
long_long values[NUM_EVENTS];
if ((retval = PAPI_stop_counters(values, NUM_EVENTS)) < PAPI_OK) {
fprintf(stderr, "PAPI failed to start counters: %s\n", PAPI_strerror(retval));
exit(1);
}
// int retval=0;
// long_long values[NUM_EVENTS];
//
// if ((retval = PAPI_stop_counters(values, NUM_EVENTS)) < PAPI_OK) {
// fprintf(stderr, "PAPI failed to start counters: %s\n", PAPI_strerror(retval));
// exit(1);
// }
// if ( ( retval = PAPI_flops( &counters.rtime, &counters.ptime, &counters.flops, &counters.mflops ) ) < PAPI_OK ){
// fprintf(stderr,"Call to PAPI_flops failed: %s\n", PAPI_strerror(retval));
// exit(1);
// }
timer.stop();
counters.l1 = values[0];
energy_consume.stop();
counters.rtime = timer.get_time();
counters.whours = energy_consume.getWH();
// unfortunately the following do not work for xeon-phi:
// counters.l2 = values[1];
// counters.l3 = values[2];
}
CounterBin PapiBin::getBin(){
......
......@@ -8,17 +8,13 @@
#include <stdlib.h>
#include "timer.h"
#include "energy.h"
#define NUM_EVENTS 1
struct CounterBin{
long_long l1;
long_long l2;
// long_long l3;
double whours;
double rtime;
// float ptime;
// long_long flops;
// float mflops;
};
class PapiBin{
......@@ -29,9 +25,10 @@ public:
CounterBin getBin();
private:
CUtilTimer timer;
Hioki energy_consume;
// const int NUM_EVENTS=3;
// int events[NUM_EVENTS] = { PAPI_L1_DCM , PAPI_L2_DCM, PAPI_L3_DCM };
int events[NUM_EVENTS] = { PAPI_L1_DCM };
// int events[NUM_EVENTS] = { PAPI_L1_DCM };
CounterBin counters;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment