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

Side by Side Diff: src/counters.h

Issue 1681943002: [counter] Properly measure own-time of runtime counters. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@2016-02-08_builtins_timer_1678973002
Patch Set: fixing type 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 unified diff | Download patch
« no previous file with comments | « src/builtins.cc ('k') | src/counters.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project 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 #ifndef V8_COUNTERS_H_ 5 #ifndef V8_COUNTERS_H_
6 #define V8_COUNTERS_H_ 6 #define V8_COUNTERS_H_
7 7
8 #include "include/v8.h" 8 #include "include/v8.h"
9 #include "src/allocation.h" 9 #include "src/allocation.h"
10 #include "src/base/platform/elapsed-timer.h" 10 #include "src/base/platform/elapsed-timer.h"
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 SC(lo_space_bytes_used, V8.MemoryLoSpaceBytesUsed) \ 694 SC(lo_space_bytes_used, V8.MemoryLoSpaceBytesUsed) \
695 SC(turbo_escape_allocs_replaced, V8.TurboEscapeAllocsReplaced) \ 695 SC(turbo_escape_allocs_replaced, V8.TurboEscapeAllocsReplaced) \
696 SC(crankshaft_escape_allocs_replaced, V8.CrankshaftEscapeAllocsReplaced) \ 696 SC(crankshaft_escape_allocs_replaced, V8.CrankshaftEscapeAllocsReplaced) \
697 SC(turbo_escape_loads_replaced, V8.TurboEscapeLoadsReplaced) \ 697 SC(turbo_escape_loads_replaced, V8.TurboEscapeLoadsReplaced) \
698 SC(crankshaft_escape_loads_replaced, V8.CrankshaftEscapeLoadsReplaced) \ 698 SC(crankshaft_escape_loads_replaced, V8.CrankshaftEscapeLoadsReplaced) \
699 /* Total code size (including metadata) of baseline code or bytecode. */ \ 699 /* Total code size (including metadata) of baseline code or bytecode. */ \
700 SC(total_baseline_code_size, V8.TotalBaselineCodeSize) \ 700 SC(total_baseline_code_size, V8.TotalBaselineCodeSize) \
701 /* Total count of functions compiled using the baseline compiler. */ \ 701 /* Total count of functions compiled using the baseline compiler. */ \
702 SC(total_baseline_compile_count, V8.TotalBaselineCompileCount) 702 SC(total_baseline_compile_count, V8.TotalBaselineCompileCount)
703 703
704 typedef struct RuntimeCallCounter {
705 int64_t count = 0;
706 base::TimeDelta time;
707 RuntimeCallCounter* parent_counter;
708
709 void Reset();
710 } RuntimeCallCounter;
711
704 struct RuntimeCallStats { 712 struct RuntimeCallStats {
705 #define CALL_RUNTIME_COUNTER(name, nargs, ressize) \ 713 #define CALL_RUNTIME_COUNTER(name, nargs, ressize) \
706 uint32_t Count_Runtime_##name; \ 714 RuntimeCallCounter Runtime_##name;
707 base::TimeDelta Time_Runtime_##name;
708 FOR_EACH_INTRINSIC(CALL_RUNTIME_COUNTER) 715 FOR_EACH_INTRINSIC(CALL_RUNTIME_COUNTER)
709 #undef CALL_RUNTIME_COUNTER 716 #undef CALL_RUNTIME_COUNTER
710 #define CALL_BUILTIN_COUNTER(name, type) \ 717 #define CALL_BUILTIN_COUNTER(name, type) RuntimeCallCounter Builtin_##name;
711 uint32_t Count_Builtin_##name; \
712 base::TimeDelta Time_Builtin_##name;
713 BUILTIN_LIST_C(CALL_BUILTIN_COUNTER) 718 BUILTIN_LIST_C(CALL_BUILTIN_COUNTER)
714 #undef CALL_BUILTIN_COUNTER 719 #undef CALL_BUILTIN_COUNTER
715 720
716 // Dummy counter for the unexpected stub miss. 721 // Dummy counter for the unexpected stub miss.
717 uint32_t Count_UnexpectedStubMiss; 722 RuntimeCallCounter UnexpectedStubMiss;
718 base::TimeDelta Time_UnexpectedStubMiss; 723 // Counter to track recursive time events.
724 RuntimeCallCounter* current_counter;
719 725
720 bool in_runtime_call = false; 726 // Starting measuring the time for a function. This will establish the
727 // connection to the parent counter for properly calculating the own times.
728 void Enter(RuntimeCallCounter* counter);
729 // Leave a scope for a measured runtime function. This will properly add
730 // the time delta to the current_counter and subtract the delta from its
731 // parent.
732 void Leave(base::TimeDelta time);
721 733
722 void Reset(); 734 void Reset();
723 void Print(std::ostream& os); 735 void Print(std::ostream& os);
724 736
725 RuntimeCallStats() { Reset(); } 737 RuntimeCallStats() { Reset(); }
726 }; 738 };
727 739
728 // This file contains all the v8 counters that are in use. 740 // This file contains all the v8 counters that are in use.
729 class Counters { 741 class Counters {
730 public: 742 public:
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 915
904 explicit Counters(Isolate* isolate); 916 explicit Counters(Isolate* isolate);
905 917
906 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters); 918 DISALLOW_IMPLICIT_CONSTRUCTORS(Counters);
907 }; 919 };
908 920
909 } // namespace internal 921 } // namespace internal
910 } // namespace v8 922 } // namespace v8
911 923
912 #endif // V8_COUNTERS_H_ 924 #endif // V8_COUNTERS_H_
OLDNEW
« no previous file with comments | « src/builtins.cc ('k') | src/counters.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698