diff options
author | Robin Watts <Robin.Watts@artifex.com> | 2016-03-22 15:59:15 +0000 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2016-03-22 16:58:18 +0000 |
commit | 58ba255e29bad8a3d7e660620d9b0201c42a3fdc (patch) | |
tree | c8766c6b4281ca43e1df1c32f6e13d2ec9d7ba08 /source/tools/mutool.c | |
parent | 8f7f4981d031ffa907cdfd2767438276ebb6ae7c (diff) | |
download | mupdf-58ba255e29bad8a3d7e660620d9b0201c42a3fdc.tar.xz |
Add Google Perf Tools build.
"make build=gperf" will now build and link the google perf tools
library into mutool. When mutool is then run, a mutool.prof file
is dropped into the current directory that can be analysed.
Diffstat (limited to 'source/tools/mutool.c')
-rw-r--r-- | source/tools/mutool.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/source/tools/mutool.c b/source/tools/mutool.c index 6d2cfa40..1f163b21 100644 --- a/source/tools/mutool.c +++ b/source/tools/mutool.c @@ -41,12 +41,30 @@ namematch(const char *end, const char *start, const char *match) return ((end-len >= start) && (strncmp(end-len, match, len) == 0)); } +#ifdef GPERF +#include "gperftools/profiler.h" + +static int profiled_main(int argc, char **argv); + +int main(int argc, char **argv) +{ + int ret; + ProfilerStart("mutool.prof"); + ret = profiled_main(argc, argv); + ProfilerStop(); + return ret; +} + +static int profiled_main(int argc, char **argv) +#else int main(int argc, char **argv) +#endif { char *start, *end; char buf[32]; int i; + if (argc == 0) { fprintf(stderr, "No command name found!\n"); |