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

Unified Diff: components/metrics/profiler/profiler_metrics_provider.cc

Issue 2488073002: Reuse ThreadData instances associated with terminated named threads. (Closed)
Patch Set: rebase Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: components/metrics/profiler/profiler_metrics_provider.cc
diff --git a/components/metrics/profiler/profiler_metrics_provider.cc b/components/metrics/profiler/profiler_metrics_provider.cc
index 2ab8c0314f6712ddfe9e48ce2c154ed5a56cab7f..3c3ffbad6aa376ed073053fd98a6315975ec2e40 100644
--- a/components/metrics/profiler/profiler_metrics_provider.cc
+++ b/components/metrics/profiler/profiler_metrics_provider.cc
@@ -4,7 +4,6 @@
#include "components/metrics/profiler/profiler_metrics_provider.h"
-#include <ctype.h>
#include <stddef.h>
#include <string>
#include <vector>
@@ -16,23 +15,6 @@
namespace metrics {
namespace {
-// Maps a thread name by replacing trailing sequence of digits with "*".
-// Examples:
-// 1. "BrowserBlockingWorker1/23857" => "BrowserBlockingWorker1/*"
-// 2. "Chrome_IOThread" => "Chrome_IOThread"
-std::string MapThreadName(const std::string& thread_name) {
- size_t i = thread_name.length();
-
- while (i > 0 && isdigit(thread_name[i - 1])) {
- --i;
- }
-
- if (i == thread_name.length())
- return thread_name;
-
- return thread_name.substr(0, i) + '*';
-}
-
// Normalizes a source filename (which is platform- and build-method-dependent)
// by extracting the last component of the full file name.
// Example: "c:\b\build\slave\win\build\src\chrome\app\chrome_main.cc" =>
@@ -52,9 +34,9 @@ void WriteProfilerData(
ProfilerEventProto::TrackedObject* tracked_object =
performance_profile->add_tracked_object();
tracked_object->set_birth_thread_name_hash(
- MetricsLog::Hash(MapThreadName(task.birth.thread_name)));
+ MetricsLog::Hash(task.birth.sanitized_thread_name));
tracked_object->set_exec_thread_name_hash(
- MetricsLog::Hash(MapThreadName(task.death_thread_name)));
+ MetricsLog::Hash(task.death_sanitized_thread_name));
tracked_object->set_source_file_name_hash(
MetricsLog::Hash(NormalizeFileName(task.birth.location.file_name)));
tracked_object->set_source_function_name_hash(

Powered by Google App Engine
This is Rietveld 408576698