diff options
author | William Tambellini <wtambellini@sdl.com> | 2020-08-06 22:06:44 -0700 |
---|---|---|
committer | William Tambellini <wtambellini@sdl.com> | 2020-08-07 17:38:42 -0700 |
commit | 3726c72d11e4a8a27d10450c2e5a8b40ef140110 (patch) | |
tree | 113411412c939b9d5da89301aa093a095296700b | |
parent | b09f9eda1dd64caf9f484383c6cc3e01b8f20d32 (diff) | |
download | bullet3-3726c72d11e4a8a27d10450c2e5a8b40ef140110.tar.gz |
Fix warning in examples/Utils/ChromeTraceUtil.cpp
Fix warning in examples/Utils/ChromeTraceUtil.cpp :
bullet3/examples/Utils/ChromeTraceUtil.cpp:122:62: warning:
format ‘%lu’ expects argument of type ‘long unsigned int’,
but argument 4 has type ‘long long unsigned int’ [-Wformat=]:
for startTimeDiv1000, ...
Tested:
- examples/ExampleBrowser/App_ExampleBrowser --tracing
- press the P key to write the profiler json file
- head /tmp/timings_0.json
- open /tmp/timings_0.json with chrome://tracing
-rw-r--r-- | examples/Utils/ChromeTraceUtil.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/Utils/ChromeTraceUtil.cpp b/examples/Utils/ChromeTraceUtil.cpp index a7eca7604..68a84effb 100644 --- a/examples/Utils/ChromeTraceUtil.cpp +++ b/examples/Utils/ChromeTraceUtil.cpp @@ -5,6 +5,7 @@ #include "LinearMath/btAlignedObjectArray.h" #include "Bullet3Common/b3Logging.h" #include <stdio.h> +#include <climits> struct btTiming { @@ -111,16 +112,15 @@ struct btTimings sprintf(newname, "%s%d", name, counter2++); #ifdef _WIN32 - fprintf(gTimingFile, "{\"cat\":\"timing\",\"pid\":1,\"tid\":%d,\"ts\":%I64d.%s ,\"ph\":\"B\",\"name\":\"%s\",\"args\":{}},\n", threadId, startTimeDiv1000, startTimeRem1000Str, newname); fprintf(gTimingFile, "{\"cat\":\"timing\",\"pid\":1,\"tid\":%d,\"ts\":%I64d.%s ,\"ph\":\"E\",\"name\":\"%s\",\"args\":{}}", threadId, endTimeDiv1000, endTimeRem1000Str, newname); - #else - fprintf(gTimingFile, "{\"cat\":\"timing\",\"pid\":1,\"tid\":%d,\"ts\":%" PRIu64 ".%s ,\"ph\":\"B\",\"name\":\"%s\",\"args\":{}},\n", + // Note: on 64b build, PRIu64 resolves in 'lu' whereas timings ('ts') have to be printed as 'llu'. + fprintf(gTimingFile, "{\"cat\":\"timing\",\"pid\":1,\"tid\":%d,\"ts\":%llu.%s ,\"ph\":\"B\",\"name\":\"%s\",\"args\":{}},\n", threadId, startTimeDiv1000, startTimeRem1000Str, newname); - fprintf(gTimingFile, "{\"cat\":\"timing\",\"pid\":1,\"tid\":%d,\"ts\":%" PRIu64 ".%s ,\"ph\":\"E\",\"name\":\"%s\",\"args\":{}}", + fprintf(gTimingFile, "{\"cat\":\"timing\",\"pid\":1,\"tid\":%d,\"ts\":%llu.%s ,\"ph\":\"E\",\"name\":\"%s\",\"args\":{}}", threadId, endTimeDiv1000, endTimeRem1000Str, newname); #endif #endif |