Getting getrusage() to measure system time in C

后端 未结 3 351
甜味超标
甜味超标 2020-12-17 17:40

I would like to measure the system time it takes to execute some code. To do this I know I would sandwich said code between two calls to getrusage(), but I get some unexpect

3条回答
  •  感情败类
    2020-12-17 18:11

    Use gprof. This will give give you the time taken by each function. Install gprof and use these flags for compilation -pg -fprofile-arcs -ftest-coverage.

提交回复
热议问题