Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into 1.8.7
Browse files Browse the repository at this point in the history
Conflicts:
	kernel/common/gc.rb
	kernel/common/range_mirror.rb
	vm/builtin/data.cpp
	vm/shared_state.cpp
  • Loading branch information
brixen committed Jun 23, 2015
2 parents 854648a + d1c4443 commit b823b26
Show file tree
Hide file tree
Showing 16 changed files with 135 additions and 219 deletions.
2 changes: 1 addition & 1 deletion vm/builtin/data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace rubinius {
state->memory()->needs_finalization(data, (FinalizerFunction)&Data::finalize);
}

state->vm()->metrics().m.ruby_metrics.memory_data_objects_total++;
state->vm()->metrics().m.ruby_metrics.memory_data_objects++;

return data;
}
Expand Down
3 changes: 1 addition & 2 deletions vm/builtin/thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ namespace rubinius {
state->memory()->needs_finalization(thr, (FinalizerFunction)&Thread::finalize,
FinalizeObject::eUnmanaged);

state->vm()->metrics().system_metrics.vm_threads++;
state->vm()->metrics().system_metrics.vm_threads_total++;
state->vm()->metrics().system_metrics.vm_threads_created++;

return thr;
}
Expand Down
2 changes: 1 addition & 1 deletion vm/gc/immix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace rubinius {
#endif

if(object_memory_) {
object_memory_->state()->metrics().m.ruby_metrics.memory_immix_chunks_total++;
object_memory_->state()->metrics().m.ruby_metrics.memory_immix_chunks++;

if(gc_->dec_chunks_left() <= 0) {
gc_->reset_chunks_left();
Expand Down
8 changes: 2 additions & 6 deletions vm/gc/immix_marker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,7 @@ namespace rubinius {
if(data_) {
{
timer::StopWatch<timer::milliseconds> timer(
state->vm()->metrics().m.ruby_metrics.gc_immix_conc_last_ms,
state->vm()->metrics().m.ruby_metrics.gc_immix_conc_total_ms
);
state->vm()->metrics().m.ruby_metrics.gc_immix_concurrent_ms);

// Allow for a young stop the world GC to occur
// every bunch of marks. 100 is a fairly arbitrary
Expand All @@ -100,9 +98,7 @@ namespace rubinius {

{
timer::StopWatch<timer::milliseconds> timer(
state->vm()->metrics().m.ruby_metrics.gc_immix_stop_last_ms,
state->vm()->metrics().m.ruby_metrics.gc_immix_stop_total_ms
);
state->vm()->metrics().m.ruby_metrics.gc_immix_stop_ms);

// Finish and pause
while(!state->stop_the_world()) {
Expand Down
6 changes: 1 addition & 5 deletions vm/gc/mark_sweep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ namespace rubinius {
object_memory_->state()->metrics().m.ruby_metrics.memory_large_objects++;
object_memory_->state()->metrics().m.ruby_metrics.memory_large_bytes += bytes;

object_memory_->state()->metrics().m.ruby_metrics.memory_large_objects_total++;
object_memory_->state()->metrics().m.ruby_metrics.memory_large_bytes_total += bytes;

next_collection_bytes -= bytes;
if(next_collection_bytes < 0) {
*collect_now = true;
Expand Down Expand Up @@ -126,8 +123,7 @@ namespace rubinius {
metrics::MetricsData& metrics = object_memory_->state()->metrics();

timer::StopWatch<timer::milliseconds> timer(
metrics.m.ruby_metrics.gc_large_sweep_last_ms,
metrics.m.ruby_metrics.gc_large_sweep_total_ms);
metrics.m.ruby_metrics.gc_large_sweep_ms);

last_freed = 0;

Expand Down
9 changes: 3 additions & 6 deletions vm/instruments/timing.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,22 +64,19 @@ namespace timer {

template <int factor=milliseconds>
class StopWatch {
uint64_t& lap_;
uint64_t& total_;
uint64_t start_;

public:
StopWatch(uint64_t& lap, uint64_t& total)
: lap_(lap)
, total_(total)
StopWatch(uint64_t& total)
: total_(total)
{
start_ = get_current_time();
}

~StopWatch() {
uint64_t now = get_current_time();
lap_ = (now - start_) / ((uint64_t)factor);
total_ += lap_;
total_ += (now - start_) / ((uint64_t)factor);
}
};

Expand Down
16 changes: 8 additions & 8 deletions vm/internal_threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ namespace rubinius {
if(exec_in_progress_) return;
exec_in_progress_ = true;

for(std::list<InternalThread*>::reverse_iterator i = threads_.rbegin();
for(InternalThreadList::reverse_iterator i = threads_.rbegin();
i != threads_.rend();
++i) {
(*i)->before_exec(state);
Expand All @@ -142,7 +142,7 @@ namespace rubinius {
// after execvp() call.
state->shared().env()->after_exec(state);

for(std::list<InternalThread*>::iterator i = threads_.begin();
for(InternalThreadList::iterator i = threads_.begin();
i != threads_.end();
++i) {
(*i)->after_exec(state);
Expand All @@ -157,7 +157,7 @@ namespace rubinius {
if(fork_exec_in_progress_) return;
fork_exec_in_progress_ = true;

for(std::list<InternalThread*>::reverse_iterator i = threads_.rbegin();
for(InternalThreadList::reverse_iterator i = threads_.rbegin();
i != threads_.rend();
++i) {
(*i)->before_fork_exec(state);
Expand All @@ -167,7 +167,7 @@ namespace rubinius {
void InternalThreads::after_fork_exec_parent(STATE) {
// We don't guard here on the assumption that only one thread is running
// after fork() call.
for(std::list<InternalThread*>::iterator i = threads_.begin();
for(InternalThreadList::iterator i = threads_.begin();
i != threads_.end();
++i) {
(*i)->after_fork_exec_parent(state);
Expand All @@ -179,7 +179,7 @@ namespace rubinius {
void InternalThreads::after_fork_exec_child(STATE) {
// We don't guard here on the assumption that only one thread is running
// after execvp() call.
for(std::list<InternalThread*>::iterator i = threads_.begin();
for(InternalThreadList::iterator i = threads_.begin();
i != threads_.end();
++i) {
(*i)->after_fork_exec_child(state);
Expand All @@ -195,7 +195,7 @@ namespace rubinius {
if(fork_in_progress_) return;
fork_in_progress_ = true;

for(std::list<InternalThread*>::reverse_iterator i = threads_.rbegin();
for(InternalThreadList::reverse_iterator i = threads_.rbegin();
i != threads_.rend();
++i) {
(*i)->before_fork(state);
Expand All @@ -205,7 +205,7 @@ namespace rubinius {
void InternalThreads::after_fork_parent(STATE) {
// We don't guard here on the assumption that only one thread is running
// after fork() call.
for(std::list<InternalThread*>::iterator i = threads_.begin();
for(InternalThreadList::iterator i = threads_.begin();
i != threads_.end();
++i) {
(*i)->after_fork_parent(state);
Expand All @@ -219,7 +219,7 @@ namespace rubinius {
// after fork() call.
state->shared().env()->after_fork_child(state);

for(std::list<InternalThread*>::iterator i = threads_.begin();
for(InternalThreadList::iterator i = threads_.begin();
i != threads_.end();
++i) {
(*i)->after_fork_child(state);
Expand Down
5 changes: 4 additions & 1 deletion vm/internal_threads.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
#include <list>

namespace rubinius {
class InternalThread;
class VM;

namespace metrics {
struct MetricsData;
}

typedef std::list<InternalThread*> InternalThreadList;

class InternalThread {
VM* vm_;
bool thread_running_;
Expand Down Expand Up @@ -73,7 +76,7 @@ namespace rubinius {
bool fork_exec_in_progress_;
bool shutdown_in_progress_;
utilities::thread::Mutex mutex_;
std::list<InternalThread*> threads_;
InternalThreadList threads_;

public:
InternalThreads()
Expand Down
3 changes: 1 addition & 2 deletions vm/llvm/state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,8 +292,7 @@ namespace rubinius {

{
timer::StopWatch<timer::microseconds> timer(
metrics().m.jit_metrics.time_last_us,
metrics().m.jit_metrics.time_total_us);
metrics().m.jit_metrics.time_us);

jit.compile(compile_request);

Expand Down
105 changes: 34 additions & 71 deletions vm/metrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,56 +227,36 @@ namespace rubinius {
metrics_map_.push_back(new MetricsItem(
"jit.methods.failed", metrics_collection_.jit_metrics.methods_failed));
metrics_map_.push_back(new MetricsItem(
"jit.time.last.us", metrics_collection_.jit_metrics.time_last_us));
metrics_map_.push_back(new MetricsItem(
"jit.time.total.us", metrics_collection_.jit_metrics.time_total_us));
"jit.time.us", metrics_collection_.jit_metrics.time_us));

// Object memory metrics
metrics_map_.push_back(new MetricsItem(
"memory.young.bytes.current",
"memory.young.bytes",
metrics_collection_.ruby_metrics.memory_young_bytes));
metrics_map_.push_back(new MetricsItem(
"memory.young.bytes.total",
metrics_collection_.ruby_metrics.memory_young_bytes_total));
metrics_map_.push_back(new MetricsItem(
"memory.young.objects.current",
"memory.young.objects",
metrics_collection_.ruby_metrics.memory_young_objects));
metrics_map_.push_back(new MetricsItem(
"memory.young.objects.total",
metrics_collection_.ruby_metrics.memory_young_objects_total));
"memory.young.occupancy",
metrics_collection_.ruby_metrics.memory_young_occupancy));
metrics_map_.push_back(new MetricsItem(
"memory.young.percent_used",
metrics_collection_.ruby_metrics.memory_young_percent_used));
metrics_map_.push_back(new MetricsItem(
"memory.immix.bytes.current",
"memory.immix.bytes",
metrics_collection_.ruby_metrics.memory_immix_bytes));
metrics_map_.push_back(new MetricsItem(
"memory.immix.bytes.total",
metrics_collection_.ruby_metrics.memory_immix_bytes_total));
metrics_map_.push_back(new MetricsItem(
"memory.immix.objects.current",
"memory.immix.objects",
metrics_collection_.ruby_metrics.memory_immix_objects));
metrics_map_.push_back(new MetricsItem(
"memory.immix.objects.total",
metrics_collection_.ruby_metrics.memory_immix_objects_total));
metrics_map_.push_back(new MetricsItem(
"memory.immix.chunks.current",
"memory.immix.chunks",
metrics_collection_.ruby_metrics.memory_immix_chunks));
metrics_map_.push_back(new MetricsItem(
"memory.immix.chunks.total",
metrics_collection_.ruby_metrics.memory_immix_chunks_total));
metrics_map_.push_back(new MetricsItem(
"memory.large.bytes.current",
"memory.large.bytes",
metrics_collection_.ruby_metrics.memory_large_bytes));
metrics_map_.push_back(new MetricsItem(
"memory.large.bytes.total",
metrics_collection_.ruby_metrics.memory_large_bytes_total));
metrics_map_.push_back(new MetricsItem(
"memory.large.objects.current",
"memory.large.objects",
metrics_collection_.ruby_metrics.memory_large_objects));
metrics_map_.push_back(new MetricsItem(
"memory.large.objects.total",
metrics_collection_.ruby_metrics.memory_large_objects_total));
"memory.symbols",
metrics_collection_.ruby_metrics.memory_symbols));
metrics_map_.push_back(new MetricsItem(
"memory.symbols.bytes",
metrics_collection_.ruby_metrics.memory_symbols_bytes));
Expand All @@ -285,25 +265,22 @@ namespace rubinius {
metrics_map_.push_back(new MetricsItem(
"memory.jit.bytes", metrics_collection_.ruby_metrics.memory_jit_bytes));
metrics_map_.push_back(new MetricsItem(
"memory.promoted.bytes.total",
metrics_collection_.ruby_metrics.memory_promoted_bytes_total));
"memory.promoted.bytes",
metrics_collection_.ruby_metrics.memory_promoted_bytes));
metrics_map_.push_back(new MetricsItem(
"memory.promoted.objects.total",
metrics_collection_.ruby_metrics.memory_promoted_objects_total));
"memory.promoted.objects",
metrics_collection_.ruby_metrics.memory_promoted_objects));
metrics_map_.push_back(new MetricsItem(
"memory.slab.refills.total",
metrics_collection_.ruby_metrics.memory_slab_refills_total));
"memory.slab.refills",
metrics_collection_.ruby_metrics.memory_slab_refills));
metrics_map_.push_back(new MetricsItem(
"memory.slab.refills.fails",
metrics_collection_.ruby_metrics.memory_slab_refills_fails));
metrics_map_.push_back(new MetricsItem(
"memory.data_objects.total",
metrics_collection_.ruby_metrics.memory_data_objects_total));
"memory.data_objects",
metrics_collection_.ruby_metrics.memory_data_objects));
metrics_map_.push_back(new MetricsItem(
"memory.capi_handles.total",
metrics_collection_.ruby_metrics.memory_capi_handles_total));
metrics_map_.push_back(new MetricsItem(
"memory.capi_handles.current",
"memory.capi_handles",
metrics_collection_.ruby_metrics.memory_capi_handles));
metrics_map_.push_back(new MetricsItem(
"memory.inflated_headers",
Expand All @@ -313,33 +290,22 @@ namespace rubinius {
metrics_map_.push_back(new MetricsItem(
"gc.young.count", metrics_collection_.ruby_metrics.gc_young_count));
metrics_map_.push_back(new MetricsItem(
"gc.young.last.ms", metrics_collection_.ruby_metrics.gc_young_last_ms));
metrics_map_.push_back(new MetricsItem(
"gc.young.total.ms", metrics_collection_.ruby_metrics.gc_young_total_ms));
"gc.young.ms", metrics_collection_.ruby_metrics.gc_young_ms));
metrics_map_.push_back(new MetricsItem(
"gc.young.lifetime", metrics_collection_.ruby_metrics.gc_young_lifetime));
metrics_map_.push_back(new MetricsItem(
"gc.immix.count", metrics_collection_.ruby_metrics.gc_immix_count));
metrics_map_.push_back(new MetricsItem(
"gc.immix.stop.last.ms",
metrics_collection_.ruby_metrics.gc_immix_stop_last_ms));
metrics_map_.push_back(new MetricsItem(
"gc.immix.stop.total.ms",
metrics_collection_.ruby_metrics.gc_immix_stop_total_ms));
"gc.immix.stop.ms",
metrics_collection_.ruby_metrics.gc_immix_stop_ms));
metrics_map_.push_back(new MetricsItem(
"gc.immix.concurrent.last.ms",
metrics_collection_.ruby_metrics.gc_immix_conc_last_ms));
metrics_map_.push_back(new MetricsItem(
"gc.immix.concurrent.total.ms",
metrics_collection_.ruby_metrics.gc_immix_conc_total_ms));
"gc.immix.concurrent.ms",
metrics_collection_.ruby_metrics.gc_immix_concurrent_ms));
metrics_map_.push_back(new MetricsItem(
"gc.large.count", metrics_collection_.ruby_metrics.gc_large_count));
metrics_map_.push_back(new MetricsItem(
"gc.large.sweep.last.ms",
metrics_collection_.ruby_metrics.gc_large_sweep_last_ms));
metrics_map_.push_back(new MetricsItem(
"gc.large.sweep.total.ms",
metrics_collection_.ruby_metrics.gc_large_sweep_total_ms));
"gc.large.sweep.ms",
metrics_collection_.ruby_metrics.gc_large_sweep_ms));

// I/O metrics
metrics_map_.push_back(new MetricsItem(
Expand All @@ -360,19 +326,16 @@ namespace rubinius {
"vm.inline_cache.resets",
metrics_collection_.system_metrics.vm_inline_cache_resets));
metrics_map_.push_back(new MetricsItem(
"vm.threads.current",
metrics_collection_.system_metrics.vm_threads));
"vm.threads.created",
metrics_collection_.system_metrics.vm_threads_created));
metrics_map_.push_back(new MetricsItem(
"vm.threads.total",
metrics_collection_.system_metrics.vm_threads_total));
"vm.threads.destroyed",
metrics_collection_.system_metrics.vm_threads_destroyed));

// Lock metrics
metrics_map_.push_back(new MetricsItem(
"locks.stop_the_world.last.ns",
metrics_collection_.system_metrics.locks_stop_the_world_last_ns));
metrics_map_.push_back(new MetricsItem(
"locks.stop_the_world.total.ns",
metrics_collection_.system_metrics.locks_stop_the_world_total_ns));
"locks.stop_the_world.ns",
metrics_collection_.system_metrics.locks_stop_the_world_ns));
}

void Metrics::init_ruby_metrics(STATE) {
Expand Down
Loading

0 comments on commit b823b26

Please sign in to comment.