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

Unified Diff: src/profiler/profile-generator.cc

Issue 2549653002: [profiler] Add CodeEvent entries for RCS counters statically on profiler start. (Closed)
Patch Set: 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
« no previous file with comments | « src/counters.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/profiler/profile-generator.cc
diff --git a/src/profiler/profile-generator.cc b/src/profiler/profile-generator.cc
index 436f03a721d9867e540243b720bb01b3c2922ee2..72e02b360b2cc1f1bb7f1300ad82bfc824f1093c 100644
--- a/src/profiler/profile-generator.cc
+++ b/src/profiler/profile-generator.cc
@@ -637,7 +637,16 @@ void CpuProfilesCollection::AddPathToCurrentProfiles(
ProfileGenerator::ProfileGenerator(Isolate* isolate,
CpuProfilesCollection* profiles)
- : isolate_(isolate), profiles_(profiles) {}
+ : isolate_(isolate), profiles_(profiles) {
+ RuntimeCallStats* rcs = isolate_->counters()->runtime_call_stats();
+ for (int i = 0; i < RuntimeCallStats::counters_count; ++i) {
+ RuntimeCallCounter* counter = &(rcs->*(RuntimeCallStats::counters[i]));
+ DCHECK(counter->name());
+ auto entry = new CodeEntry(CodeEventListener::FUNCTION_TAG, counter->name(),
+ CodeEntry::kEmptyNamePrefix, "native V8Runtime");
+ code_map_.AddCode(reinterpret_cast<Address>(counter), entry, 1);
+ }
+}
void ProfileGenerator::RecordTickSample(const TickSample& sample) {
std::vector<CodeEntry*> entries;
@@ -742,21 +751,7 @@ void ProfileGenerator::RecordTickSample(const TickSample& sample) {
}
CodeEntry* ProfileGenerator::FindEntry(void* address) {
- CodeEntry* entry = code_map_.FindEntry(reinterpret_cast<Address>(address));
- if (!entry) {
- RuntimeCallStats* rcs = isolate_->counters()->runtime_call_stats();
- void* start = reinterpret_cast<void*>(rcs);
- void* end = reinterpret_cast<void*>(rcs + 1);
- if (start <= address && address < end) {
- RuntimeCallCounter* counter =
- reinterpret_cast<RuntimeCallCounter*>(address);
- CHECK(counter->name());
- entry = new CodeEntry(CodeEventListener::FUNCTION_TAG, counter->name(),
- CodeEntry::kEmptyNamePrefix, "native V8Runtime");
- code_map_.AddCode(reinterpret_cast<Address>(address), entry, 1);
- }
- }
- return entry;
+ return code_map_.FindEntry(reinterpret_cast<Address>(address));
}
CodeEntry* ProfileGenerator::EntryForVMState(StateTag tag) {
« no previous file with comments | « src/counters.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698