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"
10 #include "src/arm64/decoder-arm64.h"
11 #include "src/arm64/constants-arm64.h"
16 const int kCounterNameMaxLength = 256;
17 const uint64_t kDefaultInstrumentationSamplingPeriod = 1 << 22;
20 enum InstrumentState {
21 InstrumentStateDisable = 0,
22 InstrumentStateEnable = 1
27 Gauge = 0, // Gauge counters reset themselves after reading.
28 Cumulative = 1 // Cumulative counters keep their value after reading.
34 Counter(const char* name, CounterType type = Gauge);
45 char name_[kCounterNameMaxLength];
52 class Instrument: public DecoderVisitor {
54 explicit Instrument(const char* datafile = NULL,
55 uint64_t sample_period = kDefaultInstrumentationSamplingPeriod);
58 // Declare all Visitor functions.
59 #define DECLARE(A) void Visit##A(Instruction* instr);
68 void DumpCounterNames();
69 void DumpEventMarker(unsigned marker);
70 void HandleInstrumentationEvent(unsigned event);
71 Counter* GetCounter(const char* name);
73 void InstrumentLoadStore(Instruction* instr);
74 void InstrumentLoadStorePair(Instruction* instr);
76 std::list<Counter*> counters_;
79 uint64_t sample_period_;
82 } } // namespace v8::internal
84 #endif // V8_ARM64_INSTRUMENT_ARM64_H_