1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef V8_ARM64_INSTRUMENT_ARM64_H_
6 #define V8_ARM64_INSTRUMENT_ARM64_H_
8 #include "src/globals.h"
11 #include "src/arm64/constants-arm64.h"
12 #include "src/arm64/decoder-arm64.h"
17 const int kCounterNameMaxLength = 256;
18 const uint64_t kDefaultInstrumentationSamplingPeriod = 1 << 22;
21 enum InstrumentState {
22 InstrumentStateDisable = 0,
23 InstrumentStateEnable = 1
28 Gauge = 0, // Gauge counters reset themselves after reading.
29 Cumulative = 1 // Cumulative counters keep their value after reading.
35 explicit Counter(const char* name, CounterType type = Gauge);
46 char name_[kCounterNameMaxLength];
53 class Instrument: public DecoderVisitor {
55 explicit Instrument(const char* datafile = NULL,
56 uint64_t sample_period = kDefaultInstrumentationSamplingPeriod);
59 // Declare all Visitor functions.
60 #define DECLARE(A) void Visit##A(Instruction* instr);
69 void DumpCounterNames();
70 void DumpEventMarker(unsigned marker);
71 void HandleInstrumentationEvent(unsigned event);
72 Counter* GetCounter(const char* name);
74 void InstrumentLoadStore(Instruction* instr);
75 void InstrumentLoadStorePair(Instruction* instr);
77 std::list<Counter*> counters_;
80 uint64_t sample_period_;
83 } } // namespace v8::internal
85 #endif // V8_ARM64_INSTRUMENT_ARM64_H_