Browse files

Renamed system.threads to system.threads.backtrace and added system.t…

…hreads.count
  • Loading branch information...
1 parent eb787d5 commit 337cff8649ce0fdd14b045db834fbcb446f03ab2 @ileitch ileitch committed Jun 6, 2010
Showing with 28 additions and 3 deletions.
  1. +28 −3 vm/agent_components.cpp
View
31 vm/agent_components.cpp
@@ -246,12 +246,12 @@ namespace agent {
}
};
- class ThreadInfo : public DynamicVariable {
+ class ThreadBacktrace : public DynamicVariable {
SharedState& shared_;
VM* state_;
public:
- ThreadInfo(STATE, SharedState& ss, const char* name)
+ ThreadBacktrace(STATE, SharedState& ss, const char* name)
: DynamicVariable(name)
, shared_(ss)
, state_(state)
@@ -289,6 +289,29 @@ namespace agent {
}
};
+ class ThreadCount : public DynamicVariable {
+ SharedState& shared_;
+ VM* state_;
+
+ public:
+ ThreadCount(STATE, SharedState& ss, const char* name)
+ : DynamicVariable(name)
+ , shared_(ss)
+ , state_(state)
+ {}
+
+ virtual void read(Output& output) {
+ shared_.interrupts.set_timer();
+ GlobalLock::LockGuard guard(shared_.global_lock());
+
+ output.ok("value");
+
+ std::list<ManagedThread*>* thrs = shared_.threads();
+
+ output.e().write_integer(thrs->size());
+ }
+ };
+
template <typename T>
class ReadInteger : public DynamicVariable {
T* ptr_;
@@ -352,7 +375,9 @@ namespace agent {
jit->add(new ReadInteger<size_t>("methods", &ss.stats.jitted_methods));
jit->add(new ReadInteger<size_t>("time", &ss.stats.jit_time_spent));
- system_->add(new ThreadInfo(state, ss, "threads"));
+ Tree* threads = system_->get_tree("threads");
+ threads->add(new ThreadBacktrace(state, ss, "backtrace"));
+ threads->add(new ThreadCount(state, ss, "count"));
}
void VariableAccess::read_path(Output& output, const char* ipath) {

0 comments on commit 337cff8

Please sign in to comment.