#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <likwid.h>
int main(int argc, char* argv[])
{
int i, j;
int err;
int* cpus;
int gid;
double result = 0.0;
char estr[] = "L2_LINES_IN_ALL:PMC0,L2_TRANS_L2_WB:PMC1";
if (err < 0)
{
printf("Failed to initialize LIKWID's topology module\n");
return 1;
}
printf(
"Likwid example on a %s with %d CPUs\n", info->
name, topo->
numHWThreads);
if (!cpus)
return 1;
{
}
if (err < 0)
{
printf("Failed to initialize LIKWID's performance monitoring module\n");
return 1;
}
if (gid < 0)
{
printf("Failed to add event string %s to LIKWID's performance monitoring module\n", estr);
return 1;
}
if (err < 0)
{
printf("Failed to setup group %d in LIKWID's performance monitoring module\n", gid);
return 1;
}
if (err < 0)
{
printf("Failed to start counters for group %d for thread %d\n",gid, (-1*err)-1);
return 1;
}
sleep(10);
if (err < 0)
{
printf("Failed to stop counters for group %d for thread %d\n",gid, (-1*err)-1);
return 1;
}
char* ptr = strtok(estr,",");
j = 0;
while (ptr != NULL)
{
{
printf("Measurement result for event set %s at CPU %d: %f\n", ptr, cpus[i], result);
}
ptr = strtok(NULL,",");
j++;
}
free(cpus);
return 0;
}
*/ /*!