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

Side by Side Diff: base/debug/activity_tracker.cc

Issue 2886933003: Use stricter type checking in UMA_HISTOGRAM_ENUMERATION (Closed)
Patch Set: simplify type checking Created 3 years, 5 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/debug/activity_tracker.h" 5 #include "base/debug/activity_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after
1364 DCHECK_LE(stack_memory_size_, allocator_->GetAllocSize(mem_reference)); 1364 DCHECK_LE(stack_memory_size_, allocator_->GetAllocSize(mem_reference));
1365 1365
1366 // Create a tracker with the acquired memory and set it as the tracker 1366 // Create a tracker with the acquired memory and set it as the tracker
1367 // for this particular thread in thread-local-storage. 1367 // for this particular thread in thread-local-storage.
1368 ManagedActivityTracker* tracker = 1368 ManagedActivityTracker* tracker =
1369 new ManagedActivityTracker(mem_reference, mem_base, stack_memory_size_); 1369 new ManagedActivityTracker(mem_reference, mem_base, stack_memory_size_);
1370 DCHECK(tracker->IsValid()); 1370 DCHECK(tracker->IsValid());
1371 this_thread_tracker_.Set(tracker); 1371 this_thread_tracker_.Set(tracker);
1372 int old_count = thread_tracker_count_.fetch_add(1, std::memory_order_relaxed); 1372 int old_count = thread_tracker_count_.fetch_add(1, std::memory_order_relaxed);
1373 1373
1374 UMA_HISTOGRAM_ENUMERATION("ActivityTracker.ThreadTrackers.Count", 1374 UMA_HISTOGRAM_EXACT_LINEAR("ActivityTracker.ThreadTrackers.Count",
1375 old_count + 1, kMaxThreadCount); 1375 old_count + 1, static_cast<int>(kMaxThreadCount));
1376 return tracker; 1376 return tracker;
1377 } 1377 }
1378 1378
1379 void GlobalActivityTracker::ReleaseTrackerForCurrentThreadForTesting() { 1379 void GlobalActivityTracker::ReleaseTrackerForCurrentThreadForTesting() {
1380 ThreadActivityTracker* tracker = 1380 ThreadActivityTracker* tracker =
1381 reinterpret_cast<ThreadActivityTracker*>(this_thread_tracker_.Get()); 1381 reinterpret_cast<ThreadActivityTracker*>(this_thread_tracker_.Get());
1382 if (tracker) { 1382 if (tracker) {
1383 this_thread_tracker_.Set(nullptr); 1383 this_thread_tracker_.Set(nullptr);
1384 delete tracker; 1384 delete tracker;
1385 } 1385 }
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1783 : GlobalActivityTracker::ScopedThreadActivity( 1783 : GlobalActivityTracker::ScopedThreadActivity(
1784 program_counter, 1784 program_counter,
1785 nullptr, 1785 nullptr,
1786 Activity::ACT_PROCESS_WAIT, 1786 Activity::ACT_PROCESS_WAIT,
1787 ActivityData::ForProcess(process->Pid()), 1787 ActivityData::ForProcess(process->Pid()),
1788 /*lock_allowed=*/true) {} 1788 /*lock_allowed=*/true) {}
1789 #endif 1789 #endif
1790 1790
1791 } // namespace debug 1791 } // namespace debug
1792 } // namespace base 1792 } // namespace base
OLDNEW
« no previous file with comments | « base/android/library_loader/library_loader_hooks.cc ('k') | base/metrics/histogram_functions_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698