OLD | NEW |
1 // Copyright (c) 2005, Google Inc. | 1 // Copyright (c) 2005, Google Inc. |
2 // All rights reserved. | 2 // All rights reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // * Redistributions of source code must retain the above copyright | 8 // * Redistributions of source code must retain the above copyright |
9 // notice, this list of conditions and the following disclaimer. | 9 // notice, this list of conditions and the following disclaimer. |
10 // * Redistributions in binary form must reproduce the above | 10 // * Redistributions in binary form must reproduce the above |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 | 56 |
57 int i, m; | 57 int i, m; |
58 char b[128]; | 58 char b[128]; |
59 MutexLock ml(&mutex); | 59 MutexLock ml(&mutex); |
60 for (m = 0; m < 1000000; ++m) { // run millions of times | 60 for (m = 0; m < 1000000; ++m) { // run millions of times |
61 for (i = 0; i < g_iters; ++i ) { | 61 for (i = 0; i < g_iters; ++i ) { |
62 result ^= i; | 62 result ^= i; |
63 } | 63 } |
64 snprintf(b, sizeof(b), "other: %d", result); // get some libc action | 64 snprintf(b, sizeof(b), "other: %d", result); // get some libc action |
65 } | 65 } |
| 66 |
| 67 ProfilerUnregisterThread(); |
66 #endif | 68 #endif |
67 } | 69 } |
68 | 70 |
69 static void test_main_thread() { | 71 static void test_main_thread() { |
70 int i, m; | 72 int i, m; |
71 char b[128]; | 73 char b[128]; |
72 MutexLock ml(&mutex); | 74 MutexLock ml(&mutex); |
73 for (m = 0; m < 1000000; ++m) { // run millions of times | 75 for (m = 0; m < 1000000; ++m) { // run millions of times |
74 for (i = 0; i < g_iters; ++i ) { | 76 for (i = 0; i < g_iters; ++i ) { |
75 result ^= i; | 77 result ^= i; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 #endif | 135 #endif |
134 | 136 |
135 test_main_thread(); | 137 test_main_thread(); |
136 | 138 |
137 if (filename) { | 139 if (filename) { |
138 ProfilerStop(); | 140 ProfilerStop(); |
139 } | 141 } |
140 | 142 |
141 return 0; | 143 return 0; |
142 } | 144 } |
OLD | NEW |