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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_database.cc

Issue 1433603004: Add ProcessMetrics::CreateCurrentProcessMetrics() method. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a_counter_with_ts
Patch Set: Remove patch dependency Created 5 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/safe_browsing/safe_browsing_database.h" 5 #include "chrome/browser/safe_browsing/safe_browsing_database.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iterator> 8 #include <iterator>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 SafeBrowsingStore* url_store, 1422 SafeBrowsingStore* url_store,
1423 PrefixSetId prefix_set_id, 1423 PrefixSetId prefix_set_id,
1424 FailureType finish_failure_type, 1424 FailureType finish_failure_type,
1425 FailureType write_failure_type, 1425 FailureType write_failure_type,
1426 bool store_full_hashes_in_prefix_set) { 1426 bool store_full_hashes_in_prefix_set) {
1427 DCHECK(db_task_runner_->RunsTasksOnCurrentThread()); 1427 DCHECK(db_task_runner_->RunsTasksOnCurrentThread());
1428 DCHECK(url_store); 1428 DCHECK(url_store);
1429 1429
1430 // Measure the amount of IO during the filter build. 1430 // Measure the amount of IO during the filter build.
1431 base::IoCounters io_before, io_after; 1431 base::IoCounters io_before, io_after;
1432 base::ProcessHandle handle = base::GetCurrentProcessHandle();
1433 scoped_ptr<base::ProcessMetrics> metric( 1432 scoped_ptr<base::ProcessMetrics> metric(
1434 #if !defined(OS_MACOSX) 1433 base::ProcessMetrics::CreateCurrentProcessMetrics());
1435 base::ProcessMetrics::CreateProcessMetrics(handle)
1436 #else
1437 // Getting stats only for the current process is enough, so NULL is fine.
1438 base::ProcessMetrics::CreateProcessMetrics(handle, NULL)
1439 #endif
1440 );
1441 1434
1442 // IoCounters are currently not supported on Mac, and may not be 1435 // IoCounters are currently not supported on Mac, and may not be
1443 // available for Linux, so we check the result and only show IO 1436 // available for Linux, so we check the result and only show IO
1444 // stats if they are available. 1437 // stats if they are available.
1445 const bool got_counters = metric->GetIOCounters(&io_before); 1438 const bool got_counters = metric->GetIOCounters(&io_before);
1446 1439
1447 const base::TimeTicks before = base::TimeTicks::Now(); 1440 const base::TimeTicks before = base::TimeTicks::Now();
1448 1441
1449 // TODO(shess): Perhaps refactor to let builder accumulate full hashes on the 1442 // TODO(shess): Perhaps refactor to let builder accumulate full hashes on the
1450 // fly? Other clients use the SBAddFullHash vector, but AFAICT they only use 1443 // fly? Other clients use the SBAddFullHash vector, but AFAICT they only use
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
1822 else 1815 else
1823 NOTREACHED(); // Add support for new lists above. 1816 NOTREACHED(); // Add support for new lists above.
1824 1817
1825 // Histogram properties as in UMA_HISTOGRAM_COUNTS macro. 1818 // Histogram properties as in UMA_HISTOGRAM_COUNTS macro.
1826 base::HistogramBase* histogram_pointer = base::Histogram::FactoryGet( 1819 base::HistogramBase* histogram_pointer = base::Histogram::FactoryGet(
1827 histogram_name, 1, 1000000, 50, 1820 histogram_name, 1, 1000000, 50,
1828 base::HistogramBase::kUmaTargetedHistogramFlag); 1821 base::HistogramBase::kUmaTargetedHistogramFlag);
1829 1822
1830 histogram_pointer->Add(file_size_kilobytes); 1823 histogram_pointer->Add(file_size_kilobytes);
1831 } 1824 }
OLDNEW
« no previous file with comments | « base/trace_event/process_memory_totals_dump_provider.cc ('k') | content/browser/browser_main_loop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698