Skip to content

Wrapper around perf stat command to call it within c program.

License

Notifications You must be signed in to change notification settings

P-p-H-d/libcallperf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libcallperf

Library for using the linux 'perf stat' command within an isolated portion of a program

Usage:

int libcallperf_start(char *what)

Start a measure with the perf stat command. 'what' is an extra parameter for the perf command, or NULL if none special. It returns 0 in case of success.

struct libcallperf_report_s *libcallperf_stop(void)

Stop the measure and returns a measure report. Or NULL in case of failure.

double libcallperf_get (const struct libcallperf_report_s *report, const char name[])

Get the value associated to the name 'name' in the report and return it. Return NAN if the name is not present in the report.

void libcallperf_print (FILE *stream, const struct libcallperf_report_s *report)

Print all the report on the given stream.

void libcallperf_free (struct libcallperf_report_s *report);

Free the report.

Example

See test.c

Limitation:

  • Not precise enought for small measure.
  • Not for production.

About

Wrapper around perf stat command to call it within c program.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published