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

Unified Diff: src/runtime/runtime.cc

Issue 1688783005: Reland of [counters] moving runtime counters to counter.h (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-internal.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime.cc
diff --git a/src/runtime/runtime.cc b/src/runtime/runtime.cc
index a59a21b509f246cd95142c7b8c77da9b2f446932..151e240f2505c89d6db87b4ed3829533df6c3471 100644
--- a/src/runtime/runtime.cc
+++ b/src/runtime/runtime.cc
@@ -3,8 +3,6 @@
// found in the LICENSE file.
#include "src/runtime/runtime.h"
-
-#include <iomanip>
#include "src/assembler.h"
#include "src/contexts.h"
@@ -133,79 +131,5 @@
}
-class RuntimeCallStatEntries {
- public:
- void Print(std::ostream& os) {
- if (total_call_count > 0) {
- std::sort(entries.rbegin(), entries.rend());
- os << "Runtime function Time "
- "Count"
- << std::endl
- << std::string(70, '=') << std::endl;
- for (Entry& entry : entries) {
- entry.Print(os);
- }
- os << std::string(60, '-') << std::endl;
- Entry("Total", total_time, total_call_count).Print(os);
- }
- }
-
- void Add(const char* name, base::TimeDelta time, uint32_t count) {
- entries.push_back(Entry(name, time, count));
- total_time += time;
- total_call_count += count;
- }
-
- private:
- class Entry {
- public:
- Entry(const char* name, base::TimeDelta time, uint64_t count)
- : name_(name), time_(time.InMilliseconds()), count_(count) {}
-
- bool operator<(const Entry& other) const {
- if (time_ < other.time_) return true;
- if (time_ > other.time_) return false;
- return count_ < other.count_;
- }
-
- void Print(std::ostream& os) {
- os << std::setw(50) << name_;
- os << std::setw(8) << time_ << "ms";
- os << std::setw(10) << count_ << std::endl;
- }
-
- private:
- const char* name_;
- int64_t time_;
- uint64_t count_;
- };
-
- uint64_t total_call_count = 0;
- base::TimeDelta total_time;
- std::vector<Entry> entries;
-};
-
-
-void RuntimeCallStats::Print(std::ostream& os) {
- RuntimeCallStatEntries entries;
-
-#define PRINT_COUNTER(name, nargs, ressize) \
- if (this->Count_Runtime_##name > 0) { \
- entries.Add(#name, this->Time_Runtime_##name, this->Count_Runtime_##name); \
- }
- FOR_EACH_INTRINSIC(PRINT_COUNTER)
-#undef PRINT_COUNTER
- entries.Print(os);
-}
-
-
-void RuntimeCallStats::Reset() {
-#define RESET_COUNTER(name, nargs, ressize) \
- Count_Runtime_##name = 0; \
- Time_Runtime_##name = base::TimeDelta();
- FOR_EACH_INTRINSIC(RESET_COUNTER)
-#undef RESET_COUNTER
-}
-
} // namespace internal
} // namespace v8
« no previous file with comments | « src/runtime/runtime.h ('k') | src/runtime/runtime-internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698