OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <algorithm> | 5 #include <algorithm> |
6 #include <windows.h> | 6 #include <windows.h> |
7 #include <tlhelp32.h> // for CreateToolhelp32Snapshot() | 7 #include <tlhelp32.h> // for CreateToolhelp32Snapshot() |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "tools/memory_watcher/memory_watcher.h" | 10 #include "tools/memory_watcher/memory_watcher.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/metrics/stats_counters.h" | 13 #include "base/metrics/stats_counters.h" |
14 #include "base/string_util.h" | 14 #include "base/strings/string_util.h" |
15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
16 #include "base/synchronization/lock.h" | 16 #include "base/synchronization/lock.h" |
17 #include "tools/memory_watcher/call_stack.h" | 17 #include "tools/memory_watcher/call_stack.h" |
18 #include "tools/memory_watcher/preamble_patcher.h" | 18 #include "tools/memory_watcher/preamble_patcher.h" |
19 | 19 |
20 static base::StatsCounter mem_in_use("MemoryInUse.Bytes"); | 20 static base::StatsCounter mem_in_use("MemoryInUse.Bytes"); |
21 static base::StatsCounter mem_in_use_blocks("MemoryInUse.Blocks"); | 21 static base::StatsCounter mem_in_use_blocks("MemoryInUse.Blocks"); |
22 static base::StatsCounter mem_in_use_allocs("MemoryInUse.Allocs"); | 22 static base::StatsCounter mem_in_use_allocs("MemoryInUse.Allocs"); |
23 static base::StatsCounter mem_in_use_frees("MemoryInUse.Frees"); | 23 static base::StatsCounter mem_in_use_frees("MemoryInUse.Frees"); |
24 | 24 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 CallStack* stack = stack_track->stack; | 246 CallStack* stack = stack_track->stack; |
247 PrivateAllocatorString output; | 247 PrivateAllocatorString output; |
248 stack->ToString(&output); | 248 stack->ToString(&output); |
249 fprintf(file_, "%s", output.c_str()); | 249 fprintf(file_, "%s", output.c_str()); |
250 } | 250 } |
251 fprintf(file_, "Total Leaks: %d\n", total_blocks); | 251 fprintf(file_, "Total Leaks: %d\n", total_blocks); |
252 fprintf(file_, "Total Stacks: %d\n", stack_tracks.size()); | 252 fprintf(file_, "Total Stacks: %d\n", stack_tracks.size()); |
253 fprintf(file_, "Total Bytes: %d\n", total_bytes); | 253 fprintf(file_, "Total Bytes: %d\n", total_bytes); |
254 CloseLogFile(); | 254 CloseLogFile(); |
255 } | 255 } |
OLD | NEW |