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