Revision: 13172
Author: [email protected]
Date: Fri Dec 7 05:47:42 2012
Log: Remove SlidingStateWindow and related code.
Review URL: https://codereview.chromium.org/11441034
http://code.google.com/p/v8/source/detail?r=13172
Modified:
/branches/bleeding_edge/include/v8.h
/branches/bleeding_edge/src/api.cc
/branches/bleeding_edge/src/flag-definitions.h
/branches/bleeding_edge/src/log.cc
/branches/bleeding_edge/src/log.h
/branches/bleeding_edge/src/v8-counters.cc
/branches/bleeding_edge/src/v8-counters.h
/branches/bleeding_edge/src/v8globals.h
=======================================
--- /branches/bleeding_edge/include/v8.h Wed Dec 5 02:14:10 2012
+++ /branches/bleeding_edge/include/v8.h Fri Dec 7 05:47:42 2012
@@ -3205,12 +3205,6 @@
static void SetCreateHistogramFunction(CreateHistogramCallback);
static void SetAddHistogramSampleFunction(AddHistogramSampleCallback);
- /**
- * Enables the computation of a sliding window of states. The sliding
- * window information is recorded in statistics counters.
- */
- static void EnableSlidingStateWindow();
-
/** Callback function for reporting failed access checks.*/
static void
SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback);
=======================================
--- /branches/bleeding_edge/src/api.cc Wed Dec 5 02:14:10 2012
+++ /branches/bleeding_edge/src/api.cc Fri Dec 7 05:47:42 2012
@@ -5391,13 +5391,6 @@
SetAddHistogramSampleFunction(callback);
}
-void V8::EnableSlidingStateWindow() {
- i::Isolate* isolate = i::Isolate::Current();
- if (IsDeadCheck(isolate, "v8::V8::EnableSlidingStateWindow()")) return;
- isolate->logger()->EnableSlidingStateWindow();
-}
-
-
void V8::SetFailedAccessCheckCallbackFunction(
FailedAccessCheckCallback callback) {
i::Isolate* isolate = i::Isolate::Current();
=======================================
--- /branches/bleeding_edge/src/flag-definitions.h Fri Dec 7 00:55:06 2012
+++ /branches/bleeding_edge/src/flag-definitions.h Fri Dec 7 05:47:42 2012
@@ -655,8 +655,6 @@
DEFINE_bool(prof_browser_mode, true,
"Used with --prof, turns on browser-compatible mode for
profiling.")
DEFINE_bool(log_regexp, false, "Log regular expression execution.")
-DEFINE_bool(sliding_state_window, false,
- "Update sliding state window counters.")
DEFINE_string(logfile, "v8.log", "Specify the name of the log file.")
DEFINE_bool(ll_prof, false, "Enable low-level linux profiler.")
DEFINE_string(gc_fake_mmap, "/tmp/__v8_gc__",
=======================================
--- /branches/bleeding_edge/src/log.cc Wed Dec 5 08:22:14 2012
+++ /branches/bleeding_edge/src/log.cc Fri Dec 7 05:47:42 2012
@@ -44,37 +44,6 @@
namespace v8 {
namespace internal {
-//
-// Sliding state window. Updates counters to keep track of the last
-// window of kBufferSize states. This is useful to track where we
-// spent our time.
-//
-class SlidingStateWindow {
- public:
- explicit SlidingStateWindow(Isolate* isolate);
- ~SlidingStateWindow();
- void AddState(StateTag state);
-
- private:
- static const int kBufferSize = 256;
- Counters* counters_;
- int current_index_;
- bool is_full_;
- byte buffer_[kBufferSize];
-
-
- void IncrementStateCounter(StateTag state) {
- counters_->state_counters(state)->Increment();
- }
-
-
- void DecrementStateCounter(StateTag state) {
- counters_->state_counters(state)->Decrement();
- }
-};
-
-
-//
// The Profiler samples pc and sp values for the main thread.
// Each sample is appended to a circular buffer.
// An independent thread removes data and writes it to the log.
@@ -189,24 +158,12 @@
public:
Ticker(Isolate* isolate, int interval):
Sampler(isolate, interval),
- window_(NULL),
profiler_(NULL) {}
~Ticker() { if (IsActive()) Stop(); }
virtual void Tick(TickSample* sample) {
if (profiler_) profiler_->Insert(sample);
- if (window_) window_->AddState(sample->state);
- }
-
- void SetWindow(SlidingStateWindow* window) {
- window_ = window;
- if (!IsActive()) Start();
- }
-
- void ClearWindow() {
- window_ = NULL;
- if (!profiler_ && IsActive() && !RuntimeProfiler::IsEnabled()) Stop();
}
void SetProfiler(Profiler* profiler) {
@@ -219,7 +176,7 @@
void ClearProfiler() {
DecreaseProfilingDepth();
profiler_ = NULL;
- if (!window_ && IsActive() && !RuntimeProfiler::IsEnabled()) Stop();
+ if (IsActive()) Stop();
}
protected:
@@ -228,42 +185,11 @@
}
private:
- SlidingStateWindow* window_;
Profiler* profiler_;
};
//
-// SlidingStateWindow implementation.
-//
-SlidingStateWindow::SlidingStateWindow(Isolate* isolate)
- : counters_(isolate->counters()), current_index_(0), is_full_(false) {
- for (int i = 0; i < kBufferSize; i++) {
- buffer_[i] = static_cast<byte>(OTHER);
- }
- isolate->logger()->ticker_->SetWindow(this);
-}
-
-
-SlidingStateWindow::~SlidingStateWindow() {
- LOGGER->ticker_->ClearWindow();
-}
-
-
-void SlidingStateWindow::AddState(StateTag state) {
- if (is_full_) {
- DecrementStateCounter(static_cast<StateTag>(buffer_[current_index_]));
- } else if (current_index_ == kBufferSize - 1) {
- is_full_ = true;
- }
- buffer_[current_index_] = static_cast<byte>(state);
- IncrementStateCounter(state);
- ASSERT(IsPowerOf2(kBufferSize));
- current_index_ = (current_index_ + 1) & (kBufferSize - 1);
-}
-
-
-//
// Profiler implementation.
//
Profiler::Profiler(Isolate* isolate)
@@ -518,7 +444,6 @@
Logger::Logger()
: ticker_(NULL),
profiler_(NULL),
- sliding_state_window_(NULL),
log_events_(NULL),
logging_nesting_(0),
cpu_profiler_nesting_(0),
@@ -1412,9 +1337,7 @@
if (--cpu_profiler_nesting_ == 0) {
profiler_->pause();
if (FLAG_prof_lazy) {
- if (!FLAG_sliding_state_window && !RuntimeProfiler::IsEnabled()) {
- ticker_->Stop();
- }
+ ticker_->Stop();
FLAG_log_code = false;
LOG(ISOLATE, UncheckedStringEvent("profiler", "pause"));
}
@@ -1435,9 +1358,7 @@
FLAG_log_code = true;
LogCompiledFunctions();
LogAccessorCallbacks();
- if (!FLAG_sliding_state_window && !ticker_->IsActive()) {
- ticker_->Start();
- }
+ if (!ticker_->IsActive()) ticker_->Start();
}
profiler_->resume();
}
@@ -1781,10 +1702,6 @@
Isolate* isolate = Isolate::Current();
ticker_ = new Ticker(isolate, kSamplingIntervalMs);
- if (FLAG_sliding_state_window && sliding_state_window_ == NULL) {
- sliding_state_window_ = new SlidingStateWindow(isolate);
- }
-
bool start_logging = FLAG_log || FLAG_log_runtime || FLAG_log_api
|| FLAG_log_code || FLAG_log_gc || FLAG_log_handles || FLAG_log_suspect
|| FLAG_log_regexp || FLAG_log_state_changes || FLAG_ll_prof
@@ -1850,9 +1767,6 @@
delete profiler_;
profiler_ = NULL;
}
-
- delete sliding_state_window_;
- sliding_state_window_ = NULL;
delete ticker_;
ticker_ = NULL;
@@ -1861,22 +1775,6 @@
}
-void Logger::EnableSlidingStateWindow() {
- // If the ticker is NULL, Logger::SetUp has not been called yet. In
- // that case, we set the sliding_state_window flag so that the
- // sliding window computation will be started when Logger::SetUp is
- // called.
- if (ticker_ == NULL) {
- FLAG_sliding_state_window = true;
- return;
- }
- // Otherwise, if the sliding state window computation has not been
- // started we do it now.
- if (sliding_state_window_ == NULL) {
- sliding_state_window_ = new SlidingStateWindow(Isolate::Current());
- }
-}
-
// Protects the state below.
static Mutex* active_samplers_mutex = NULL;
=======================================
--- /branches/bleeding_edge/src/log.h Wed Dec 5 08:22:14 2012
+++ /branches/bleeding_edge/src/log.h Fri Dec 7 05:47:42 2012
@@ -74,7 +74,6 @@
class LogMessageBuilder;
class Profiler;
class Semaphore;
-class SlidingStateWindow;
class Ticker;
class Isolate;
@@ -175,9 +174,6 @@
// leaving the file open.
FILE* TearDown();
- // Enable the computation of a sliding window of states.
- void EnableSlidingStateWindow();
-
// Emits an event with a string value -> (name, value).
void StringEvent(const char* name, const char* value);
@@ -433,10 +429,6 @@
// of samples.
Profiler* profiler_;
- // SlidingStateWindow instance keeping a sliding window of the most
- // recent VM states.
- SlidingStateWindow* sliding_state_window_;
-
// An array of log events names.
const char* const* log_events_;
@@ -447,7 +439,6 @@
friend class LogMessageBuilder;
friend class TimeLog;
friend class Profiler;
- friend class SlidingStateWindow;
friend class StackTracer;
friend class VMState;
=======================================
--- /branches/bleeding_edge/src/v8-counters.cc Fri Aug 10 06:09:31 2012
+++ /branches/bleeding_edge/src/v8-counters.cc Fri Dec 7 05:47:42 2012
@@ -86,17 +86,6 @@
size_of_FIXED_ARRAY_##name##_ = size_of_FIXED_ARRAY_##name;
FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC)
#undef SC
-
- StatsCounter state_counters[] = {
-#define COUNTER_NAME(name) \
- { "c:V8.State" #name, NULL, false },
- STATE_TAG_LIST(COUNTER_NAME)
-#undef COUNTER_NAME
- };
-
- for (int i = 0; i < kSlidingStateWindowCounterCount; ++i) {
- state_counters_[i] = state_counters[i];
- }
}
void Counters::ResetHistograms() {
=======================================
--- /branches/bleeding_edge/src/v8-counters.h Thu Nov 22 05:04:11 2012
+++ /branches/bleeding_edge/src/v8-counters.h Fri Dec 7 05:47:42 2012
@@ -373,16 +373,9 @@
kSizeOfFIXED_ARRAY__##name,
FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(COUNTER_ID)
#undef COUNTER_ID
-#define COUNTER_ID(name) k_##name,
- STATE_TAG_LIST(COUNTER_ID)
-#undef COUNTER_ID
stats_counter_count
};
- StatsCounter* state_counters(StateTag state) {
- return &state_counters_[state];
- }
-
void ResetHistograms();
private:
@@ -425,15 +418,6 @@
FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(SC)
#undef SC
- enum {
-#define COUNTER_ID(name) __##name,
- STATE_TAG_LIST(COUNTER_ID)
-#undef COUNTER_ID
- kSlidingStateWindowCounterCount
- };
-
- // Sliding state window counters.
- StatsCounter state_counters_[kSlidingStateWindowCounterCount];
friend class Isolate;
DISALLOW_IMPLICIT_CONSTRUCTORS(Counters);
=======================================
--- /branches/bleeding_edge/src/v8globals.h Thu Nov 22 05:04:11 2012
+++ /branches/bleeding_edge/src/v8globals.h Fri Dec 7 05:47:42 2012
@@ -351,20 +351,13 @@
// VMState object leaves a state by popping the current state from the
// stack.
-#define STATE_TAG_LIST(V) \
- V(JS) \
- V(GC) \
- V(COMPILER) \
- V(PARALLEL_COMPILER) \
- V(OTHER) \
- V(EXTERNAL)
-
enum StateTag {
-#define DEF_STATE_TAG(name) name,
- STATE_TAG_LIST(DEF_STATE_TAG)
-#undef DEF_STATE_TAG
- // Pseudo-types.
- state_tag_count
+ JS,
+ GC,
+ COMPILER,
+ PARALLEL_COMPILER,
+ OTHER,
+ EXTERNAL
};
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev