Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(839)

Side by Side Diff: components/crash/content/app/fallback_crash_handler_win.cc

Issue 2653953002: Grab crash handler's peak commit charge in fallback handler (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | components/crash/content/app/fallback_crash_handler_win_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "components/crash/content/app/fallback_crash_handler_win.h" 5 #include "components/crash/content/app/fallback_crash_handler_win.h"
6 6
7 #include <dbghelp.h> 7 #include <dbghelp.h>
8 #include <psapi.h> 8 #include <psapi.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
11 #include <map> 11 #include <map>
12 #include <memory>
13 #include <string>
12 #include <vector> 14 #include <vector>
13 15
14 #include "base/command_line.h" 16 #include "base/command_line.h"
15 #include "base/files/file.h" 17 #include "base/files/file.h"
16 #include "base/files/file_util.h" 18 #include "base/files/file_util.h"
17 #include "base/macros.h" 19 #include "base/macros.h"
18 #include "base/numerics/safe_conversions.h" 20 #include "base/numerics/safe_conversions.h"
19 #include "base/process/process_handle.h" 21 #include "base/process/process_handle.h"
20 #include "base/strings/string_number_conversions.h" 22 #include "base/strings/string_number_conversions.h"
21 #include "base/win/scoped_handle.h" 23 #include "base/win/scoped_handle.h"
(...skipping 23 matching lines...) Expand all
45 // This is in units of bytes, re-scale to pages for consistency with 47 // This is in units of bytes, re-scale to pages for consistency with
46 // system metrics. 48 // system metrics.
47 const uint64_t kPageSize = 4096; 49 const uint64_t kPageSize = 4096;
48 crash_keys->insert(std::make_pair( 50 crash_keys->insert(std::make_pair(
49 "ProcessPrivateUsage", 51 "ProcessPrivateUsage",
50 base::Uint64ToString(process_memory.PrivateUsage / kPageSize))); 52 base::Uint64ToString(process_memory.PrivateUsage / kPageSize)));
51 53
52 crash_keys->insert(std::make_pair( 54 crash_keys->insert(std::make_pair(
53 "ProcessPeakWorkingSetSize", 55 "ProcessPeakWorkingSetSize",
54 base::Uint64ToString(process_memory.PeakWorkingSetSize / kPageSize))); 56 base::Uint64ToString(process_memory.PeakWorkingSetSize / kPageSize)));
57
58 crash_keys->insert(std::make_pair(
59 "ProcessPeakPagefileUsage",
60 base::Uint64ToString(process_memory.PeakPagefileUsage / kPageSize)));
55 } 61 }
56 62
57 // Grab system commit memory. Also best effort. 63 // Grab system commit memory. Also best effort.
58 PERFORMANCE_INFORMATION perf_info = {sizeof(perf_info)}; 64 PERFORMANCE_INFORMATION perf_info = {sizeof(perf_info)};
59 if (GetPerformanceInfo(&perf_info, sizeof(perf_info))) { 65 if (GetPerformanceInfo(&perf_info, sizeof(perf_info))) {
60 // Record the remaining committable memory and the limit. This is in units 66 // Record the remaining committable memory and the limit. This is in units
61 // of system pages. 67 // of system pages.
62 crash_keys->insert(std::make_pair( 68 crash_keys->insert(std::make_pair(
63 "SystemCommitRemaining", 69 "SystemCommitRemaining",
64 base::UintToString(perf_info.CommitLimit - perf_info.CommitTotal))); 70 base::UintToString(perf_info.CommitLimit - perf_info.CommitTotal)));
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 499
494 crashpad::UUID report_id = {}; 500 crashpad::UUID report_id = {};
495 status = database->FinishedWritingCrashReport(report, &report_id); 501 status = database->FinishedWritingCrashReport(report, &report_id);
496 if (status != crashpad::CrashReportDatabase::kNoError) 502 if (status != crashpad::CrashReportDatabase::kNoError)
497 return false; 503 return false;
498 504
499 return true; 505 return true;
500 } 506 }
501 507
502 } // namespace crash_reporter 508 } // namespace crash_reporter
OLDNEW
« no previous file with comments | « no previous file | components/crash/content/app/fallback_crash_handler_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698