|
1 |
|
2 /* |
|
3 * Copyright 2011 Google Inc. |
|
4 * |
|
5 * Use of this source code is governed by a BSD-style license that can be |
|
6 * found in the LICENSE file. |
|
7 */ |
|
8 |
|
9 #ifndef SkTrace_DEFINED |
|
10 #define SkTrace_DEFINED |
|
11 |
|
12 #ifdef SK_USER_TRACE_INCLUDE_FILE |
|
13 |
|
14 /* If your system embeds skia and has complex event logging, in |
|
15 src/config/SkUserConfig.h: |
|
16 - define the three SK_TRACE_EVENT macros to map to your system's |
|
17 equivalents, |
|
18 - define the name of the include file in SK_USER_TRACE_INCLUDE_FILE |
|
19 A trivial example is given in src/utils/SkDebugTrace.h. |
|
20 |
|
21 All arguments are const char*. Skia typically passes the name of |
|
22 the object and function (and sometimes region of interest within |
|
23 the function) separated by double colons for 'event'. |
|
24 |
|
25 SK_TRACE_EVENT1 and SK_TRACE_EVENT2 take one or two arbitrary |
|
26 name-value pairs that you also want to log. SkStringPrintf() is useful |
|
27 for formatting these values. |
|
28 |
|
29 For example: |
|
30 SK_TRACE_EVENT0("GrContext::createAndLockTexture"); |
|
31 SK_TRACE_EVENT1("GrDefaultPathRenderer::onDrawPath::renderPasses", |
|
32 "verts", SkStringPrintf("%i", vert - base).c_str()); |
|
33 */ |
|
34 |
|
35 #include SK_USER_TRACE_INCLUDE_FILE |
|
36 |
|
37 #else |
|
38 |
|
39 #define SK_TRACE_EVENT0(event) |
|
40 #define SK_TRACE_EVENT1(event, name1, value1) |
|
41 #define SK_TRACE_EVENT2(event, name1, value1, name2, value2) |
|
42 |
|
43 #endif |
|
44 |
|
45 #endif |