PAPI 7.1.0.0
Loading...
Searching...
No Matches
icache.c
Go to the documentation of this file.
1#include <math.h>
2#include <sys/types.h>
3#include <string.h>
4#include <unistd.h>
5#include <stdlib.h>
6#include <stdint.h>
7#include <stdio.h>
8#include <inttypes.h>
9
10#include "papi.h"
11#include "icache.h"
12
13void i_cache_driver(char* papi_event_name, int junk, hw_desc_t *hw_desc, char* outdir, int show_progress)
14{
15 // Open output file.
16 const char *sufx = ".icache";
17 char *papiFileName;
18 FILE *ofp_papi;
19
20 (void)hw_desc;
21
22 int l = strlen(outdir)+strlen(papi_event_name)+strlen(sufx);
23 if (NULL == (papiFileName = (char *)calloc( 1+l, sizeof(char) ))) {
24 fprintf(stderr, "Failed to allocate papiFileName.\n");
25 return;
26 }
27 if (l != (sprintf(papiFileName, "%s%s%s", outdir, papi_event_name, sufx))) {
28 fprintf(stderr, "sprintf failed to copy into papiFileName.\n");
29 free(papiFileName);
30 return;
31 }
32 if (NULL == (ofp_papi = fopen(papiFileName,"w"))) {
33 fprintf(stderr, "Failed to open file %s.\n", papiFileName);
34 free(papiFileName);
35 return;
36 }
37
38 seq_driver(ofp_papi, papi_event_name, junk, show_progress);
39
40 // Close output file.
41 fclose(ofp_papi);
42 free(papiFileName);
43
44 return;
45}
void i_cache_driver(char *papi_event_name, int junk, hw_desc_t *hw_desc, char *outdir, int show_progress)
Definition: icache.c:13
void seq_driver(FILE *ofp_papi, char *papi_event_name, int init, int show_progress)
Return codes and api definitions.
FILE * stderr
int fclose(FILE *__stream)