| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/disk_cache/trace.h" | 5 #include "net/disk_cache/trace.h" |
| 6 | 6 |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #if defined(OS_WIN) | 8 #if defined(OS_WIN) |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "net/disk_cache/stress_support.h" | 13 #include "net/disk_cache/stress_support.h" |
| 14 | 14 |
| 15 // Change this value to 1 to enable tracing on a release build. By default, | 15 // Change this value to 1 to enable tracing on a release build. By default, |
| 16 // tracing is enabled only on debug builds. | 16 // tracing is enabled only on debug builds. |
| 17 #define ENABLE_TRACING 0 | 17 #define ENABLE_TRACING 0 |
| 18 | 18 |
| 19 #ifndef NDEBUG | 19 #ifndef NDEBUG |
| 20 #undef ENABLE_TRACING | 20 #undef ENABLE_TRACING |
| 21 #define ENABLE_TRACING 1 | 21 #define ENABLE_TRACING 1 |
| 22 #endif | 22 #endif |
| 23 | 23 |
| 24 namespace { | 24 namespace { |
| 25 | 25 |
| 26 const int kEntrySize = 48; | 26 const int kEntrySize = 12 * sizeof(size_t); |
| 27 #if defined(NET_BUILD_STRESS_CACHE) | 27 #if defined(NET_BUILD_STRESS_CACHE) |
| 28 const int kNumberOfEntries = 500000; | 28 const int kNumberOfEntries = 500000; |
| 29 #else | 29 #else |
| 30 const int kNumberOfEntries = 5000; // 240 KB. | 30 const int kNumberOfEntries = 5000; // 240 KB on 32bit, 480 KB on 64bit |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 bool s_trace_enabled = false; | 33 bool s_trace_enabled = false; |
| 34 | 34 |
| 35 struct TraceBuffer { | 35 struct TraceBuffer { |
| 36 int num_traces; | 36 int num_traces; |
| 37 int current; | 37 int current; |
| 38 char buffer[kNumberOfEntries][kEntrySize]; | 38 char buffer[kNumberOfEntries][kEntrySize]; |
| 39 }; | 39 }; |
| 40 | 40 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 void DestroyTrace(void) { | 170 void DestroyTrace(void) { |
| 171 s_trace_object = NULL; | 171 s_trace_object = NULL; |
| 172 } | 172 } |
| 173 | 173 |
| 174 void Trace(const char* format, ...) { | 174 void Trace(const char* format, ...) { |
| 175 } | 175 } |
| 176 | 176 |
| 177 #endif // ENABLE_TRACING | 177 #endif // ENABLE_TRACING |
| 178 | 178 |
| 179 } // namespace disk_cache | 179 } // namespace disk_cache |
| OLD | NEW |