Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0c3b9a4339ef
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5ef29c17db7c
Choose a head ref
  • 2 commits
  • 6 files changed
  • 1 contributor

Commits on May 11, 2016

  1. Added profile metrics.

    brixen committed May 11, 2016

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    97d1e2b View commit details
  2. Copy the full SHA
    5ef29c1 View commit details
Showing with 38 additions and 27 deletions.
  1. +4 −0 machine/metrics.cpp
  2. +6 −0 machine/metrics.hpp
  3. +0 −19 machine/thread_nexus.cpp
  4. +19 −1 machine/thread_nexus.hpp
  5. +3 −0 machine/vm.cpp
  6. +6 −7 machine/vm.hpp
4 changes: 4 additions & 0 deletions machine/metrics.cpp
Original file line number Diff line number Diff line change
@@ -393,6 +393,10 @@ namespace rubinius {
"machine.bytecode.verifier.us", metrics_data_.machine.bytecode_verifier_us));
metrics_map_.push_back(new MetricsItem(
"machine.bytecode.internalizer.us", metrics_data_.machine.bytecode_internalizer_us));
metrics_map_.push_back(new MetricsItem(
"machine.profiles", metrics_data_.machine.profiles));
metrics_map_.push_back(new MetricsItem(
"machine.profile.ns", metrics_data_.machine.profile_ns));

// Memory metrics
metrics_map_.push_back(new MetricsItem(
6 changes: 6 additions & 0 deletions machine/metrics.hpp
Original file line number Diff line number Diff line change
@@ -184,6 +184,8 @@ namespace rubinius {
metric bytecode_load_us;
metric bytecode_verifier_us;
metric bytecode_internalizer_us;
metric profiles;
metric profile_ns;

MachineMetrics() {
checkpoints = 0;
@@ -210,6 +212,8 @@ namespace rubinius {
bytecode_load_us = 0;
bytecode_verifier_us = 0;
bytecode_internalizer_us = 0;
profiles = 0;
profile_ns = 0;
}

void add(MachineMetrics& data) {
@@ -237,6 +241,8 @@ namespace rubinius {
bytecode_load_us += data.bytecode_load_us;
bytecode_verifier_us += data.bytecode_verifier_us;
bytecode_internalizer_us += data.bytecode_internalizer_us;
profiles += data.profiles;
profile_ns += data.profile_ns;
}
};

19 changes: 0 additions & 19 deletions machine/thread_nexus.cpp
Original file line number Diff line number Diff line change
@@ -238,25 +238,6 @@ namespace rubinius {
}
}

bool ThreadNexus::stop_lock(VM* vm) {
if(!stop_) return false;

waiting_lock(vm);

// Assumption about stop_ may change while we progress.
if(stop_) {
if(serialized_p(vm)) {
if(stop_) {
return true;
}
}
}

// Either we're not stop_'ing or something blocked us from serializing.
unlock();
return false;
}

void ThreadNexus::wait_till_alone(VM* vm) {
/* We block acquiring the sleep lock so that any waking thread that raced
* us to it will finish waking up. Any sleeping thread that wakes up after
20 changes: 19 additions & 1 deletion machine/thread_nexus.hpp
Original file line number Diff line number Diff line change
@@ -102,7 +102,25 @@ namespace rubinius {
void waiting_lock(VM* vm);
void managed_lock(VM* vm);
void sleep_lock(VM* vm);
bool stop_lock(VM* vm);

bool stop_lock(VM* vm) {
if(!stop_) return false;

waiting_lock(vm);

// Assumption about stop_ may change while we progress.
if(stop_) {
if(serialized_p(vm)) {
if(stop_) {
return true;
}
}
}

// Either we're not stop_'ing or something blocked us from serializing.
unlock();
return false;
}

void wait_till_alone(VM* vm);
};
3 changes: 3 additions & 0 deletions machine/vm.cpp
Original file line number Diff line number Diff line change
@@ -272,6 +272,9 @@ namespace rubinius {
}

void VM::update_profile(STATE) {
timer::StopWatch<timer::nanoseconds> timer(metrics().machine.profile_ns);

metrics().machine.profiles++;
profile_sample_count_++;

CompiledCode* code = state->vm()->call_frame()->compiled_code;
13 changes: 6 additions & 7 deletions machine/vm.hpp
Original file line number Diff line number Diff line change
@@ -428,17 +428,16 @@ namespace rubinius {
void checkpoint(STATE) {
metrics().machine.checkpoints++;

if(profile_counter_++ >= profile_interval_) {
if(thread_nexus_->stop_lock(this)) {
metrics().machine.stops++;
if(thread_nexus_->stop_lock(this)) {
metrics().machine.stops++;

collect_maybe(state);
collect_maybe(state);

thread_nexus_->unlock();
}
thread_nexus_->unlock();
}

if(profile_counter_++ >= profile_interval_) {
update_profile(state);

set_profile_interval();
}
}