Commit f1c4fd39 authored by Camillo Bruni's avatar Camillo Bruni Committed by V8 LUCI CQ

[profiling] Create process-unique CPU profile ids

In https://crrev.com/c/3522896 we changed the last_id_ to be a member
variable. This subtly changed how profile id's were generated.

This CL changes this part back to a static variable that guarantees
process-wide unique profile ids.

Bug: chromium:1330726, chromium:1297283
Change-Id: I5f3dddcbbc156d0dee7d1eedde8a731c53d080dc
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3684289
Auto-Submit: Camillo Bruni <cbruni@chromium.org>
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarShu-yu Guo <syg@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80902}
parent c553b02c
......@@ -570,6 +570,8 @@ void ContextFilter::OnMoveEvent(Address from_address, Address to_address) {
using v8::tracing::TracedValue;
std::atomic<ProfilerId> CpuProfilesCollection::last_id_{0};
CpuProfile::CpuProfile(CpuProfiler* profiler, ProfilerId id, const char* title,
CpuProfilingOptions options,
std::unique_ptr<DiscardedSamplesDelegate> delegate)
......@@ -892,10 +894,7 @@ size_t CodeMap::GetEstimatedMemoryUsage() const {
}
CpuProfilesCollection::CpuProfilesCollection(Isolate* isolate)
: profiler_(nullptr),
current_profiles_semaphore_(1),
last_id_(0),
isolate_(isolate) {
: profiler_(nullptr), current_profiles_semaphore_(1), isolate_(isolate) {
USE(isolate_);
}
......
......@@ -587,7 +587,7 @@ class V8_EXPORT_PRIVATE CpuProfilesCollection {
// Accessed by VM thread and profile generator thread.
std::vector<std::unique_ptr<CpuProfile>> current_profiles_;
base::Semaphore current_profiles_semaphore_;
ProfilerId last_id_;
static std::atomic<ProfilerId> last_id_;
Isolate* isolate_;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment