Skip to content

Commit

Permalink
Add output for remaining diagnostics/metrics.
Browse files Browse the repository at this point in the history
  • Loading branch information
brixen committed Feb 6, 2018
1 parent 65c5aca commit 0f32aad
Show file tree
Hide file tree
Showing 13 changed files with 172 additions and 67 deletions.
18 changes: 9 additions & 9 deletions machine/capi/handles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace rubinius {
handle->set_object(obj);
handle->validate();
if(needs_gc) {
diagnostic()->collections_++;
diagnostic()->collections++;
state->memory()->schedule_full_collection(
"CAPI handles",
state->shared().gc_metrics()->handles_set);
Expand All @@ -65,7 +65,7 @@ namespace rubinius {
handle->set_object(obj);
handle->validate();
if(needs_gc) {
diagnostic()->collections_++;
diagnostic()->collections++;
state->memory()->schedule_full_collection(
"CAPI handles",
state->shared().gc_metrics()->handles_set);
Expand All @@ -84,7 +84,7 @@ namespace rubinius {
{
std::vector<bool> chunk_marks(allocator_->chunks_.size(), false);

diagnostic()->objects_ = 0;
diagnostic()->objects = 0;

for(std::vector<int>::size_type i = 0; i < allocator_->chunks_.size(); ++i) {
Handle* chunk = allocator_->chunks_[i];
Expand All @@ -101,7 +101,7 @@ namespace rubinius {
// Strong references will already have been updated.
if(!handle->weak_p()) {
chunk_marks[i] = true;
diagnostic()->objects_++;
diagnostic()->objects++;
continue;
}

Expand All @@ -114,12 +114,12 @@ namespace rubinius {
// a collection. In this state, valid objects are only in current.
if(young->in_current_p(obj)) {
chunk_marks[i] = true;
diagnostic()->objects_++;
diagnostic()->objects++;
// A weakref pointing to a forwarded young object
} else if(obj->forwarded_p()) {
handle->set_object(obj->forward());
chunk_marks[i] = true;
diagnostic()->objects_++;
diagnostic()->objects++;
// A weakref pointing to a dead young object
} else {
handle->clear();
Expand All @@ -128,7 +128,7 @@ namespace rubinius {
// Not a young object, so won't be GC'd so mark
// chunk as still active
chunk_marks[i] = true;
diagnostic()->objects_++;
diagnostic()->objects++;
}
*/

Expand All @@ -137,7 +137,7 @@ namespace rubinius {
handle->clear();
} else {
chunk_marks[i] = true;
diagnostic()->objects_++;
diagnostic()->objects++;
}
}
}
Expand All @@ -155,7 +155,7 @@ namespace rubinius {

allocator_->rebuild_freelist(&chunk_marks);

diagnostic()->bytes_ = allocator_->in_use_ * sizeof(Handle);
diagnostic()->bytes = allocator_->in_use_ * sizeof(Handle);
}
}
}
12 changes: 12 additions & 0 deletions machine/diagnostics/codedb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ namespace rubinius {
, load_count(0)
{
set_type("CodeDBMetrics");

rapidjson::Document::AllocatorType& alloc = document_.GetAllocator();

document_.AddMember("load.ns", load_ns, alloc);
document_.AddMember("load_count", load_count, alloc);
}

virtual ~CodeDBMetrics() { }

virtual void update() {
document_["load.ns"] = load_ns;
document_["load_count"] = load_count;
}

virtual void start_reporting(STATE) {
Expand Down
14 changes: 12 additions & 2 deletions machine/diagnostics/concurrency.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,24 @@

namespace rubinius {
namespace diagnostics {
struct LockMetrics : public Diagnostic {
struct ConcurrencyMetrics : public Diagnostic {
metric stop_the_world_ns;

LockMetrics()
ConcurrencyMetrics()
: Diagnostic()
, stop_the_world_ns(0)
{
set_type("ConcurrencyMetrics");

rapidjson::Document::AllocatorType& alloc = document_.GetAllocator();

document_.AddMember("stop_the_world.ns", stop_the_world_ns, alloc);
}

virtual ~ConcurrencyMetrics() { }

virtual void update() {
document_["stop_the_world.ns"] = stop_the_world_ns;
}

virtual void start_reporting(STATE) {
Expand Down
12 changes: 12 additions & 0 deletions machine/diagnostics/console.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ namespace rubinius {
, responses_sent(0)
{
set_type("ConsoleMetrics");

rapidjson::Document::AllocatorType& alloc = document_.GetAllocator();

document_.AddMember("requests_received", requests_received, alloc);
document_.AddMember("responses_sent", responses_sent, alloc);
}

virtual ~ConsoleMetrics() { }

virtual void update() {
document_["requests_received"] = requests_received;
document_["responses_sent"] = responses_sent;
}

virtual void start_reporting(STATE) {
Expand Down
42 changes: 42 additions & 0 deletions machine/diagnostics/gc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,48 @@ namespace rubinius {
, resource_set(0)
{
set_type("GCMetrics");

rapidjson::Document::AllocatorType& alloc = document_.GetAllocator();

document_.AddMember("young_set", young_set, alloc);
document_.AddMember("young_count", young_count, alloc);
document_.AddMember("young_ms", young_ms, alloc);
document_.AddMember("immix_set", immix_set, alloc);
document_.AddMember("immix_count", immix_count, alloc);
document_.AddMember("immix_stop_ms", immix_stop_ms, alloc);
document_.AddMember("immix_suspend_ms", immix_suspend_ms, alloc);
document_.AddMember("immix_concurrent_ms", immix_concurrent_ms, alloc);
document_.AddMember("immix_diagnostics_us", immix_diagnostics_us, alloc);
document_.AddMember("large_set", large_set, alloc);
document_.AddMember("large_count", large_count, alloc);
document_.AddMember("large_sweep_us", large_sweep_us, alloc);
document_.AddMember("objects_queued", objects_queued, alloc);
document_.AddMember("objects_finalized", objects_finalized, alloc);
document_.AddMember("headers_set", headers_set, alloc);
document_.AddMember("handles_set", handles_set, alloc);
document_.AddMember("resource_set", resource_set, alloc);
}

virtual ~GCMetrics() { }

virtual void update() {
document_["young_set"] = young_set;
document_["young_count"] = young_count;
document_["young_ms"] = young_ms;
document_["immix_set"] = immix_set;
document_["immix_count"] = immix_count;
document_["immix_stop_ms"] = immix_stop_ms;
document_["immix_suspend_ms"] = immix_suspend_ms;
document_["immix_concurrent_ms"] = immix_concurrent_ms;
document_["immix_diagnostics_us"] = immix_diagnostics_us;
document_["large_set"] = large_set;
document_["large_count"] = large_count;
document_["large_sweep_us"] = large_sweep_us;
document_["objects_queued"] = objects_queued;
document_["objects_finalized"] = objects_finalized;
document_["headers_set"] = headers_set;
document_["handles_set"] = handles_set;
document_["resource_set"] = resource_set;
}

virtual void start_reporting(STATE) {
Expand Down
28 changes: 28 additions & 0 deletions machine/diagnostics/jit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,34 @@ namespace rubinius {
, inlined_ffi(0)
{
set_type("JITMetrics");

rapidjson::Document::AllocatorType& alloc = document_.GetAllocator();

document_.AddMember("methods_queued", methods_queued, alloc);
document_.AddMember("methods_compiled", methods_compiled, alloc);
document_.AddMember("methods_failed", methods_failed, alloc);
document_.AddMember("compile_time_us", compile_time_us, alloc);
document_.AddMember("uncommon_exits", uncommon_exits, alloc);
document_.AddMember("inlined_accessors", inlined_accessors, alloc);
document_.AddMember("inlined_methods", inlined_methods, alloc);
document_.AddMember("inlined_blocks", inlined_blocks, alloc);
document_.AddMember("inlined_primitives", inlined_primitives, alloc);
document_.AddMember("inlined_ffi", inlined_ffi, alloc);
}

virtual ~JITMetrics() { }

virtual void update() {
document_["methods_queued"] = methods_queued;
document_["methods_compiled"] = methods_compiled;
document_["methods_failed"] = methods_failed;
document_["compile_time_us"] = compile_time_us;
document_["uncommon_exits"] = uncommon_exits;
document_["inlined_accessors"] = inlined_accessors;
document_["inlined_methods"] = inlined_methods;
document_["inlined_blocks"] = inlined_blocks;
document_["inlined_primitives"] = inlined_primitives;
document_["inlined_ffi"] = inlined_ffi;
}

virtual void start_reporting(STATE) {
Expand Down
64 changes: 32 additions & 32 deletions machine/diagnostics/memory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,49 @@ namespace rubinius {
namespace diagnostics {
class Memory : public Diagnostic {
public:
uint64_t objects_;
uint64_t bytes_;
int64_t collections_;
uint64_t objects;
uint64_t bytes;
int64_t collections;

Memory()
: Diagnostic()
, objects_(0)
, bytes_(0)
, collections_(0)
, objects(0)
, bytes(0)
, collections(0)
{
set_type("Memory");

rapidjson::Document::AllocatorType& alloc = document_.GetAllocator();

document_.AddMember("objects", objects_, alloc);
document_.AddMember("bytes", bytes_, alloc);
document_.AddMember("collections", collections_, alloc);
document_.AddMember("objects", objects, alloc);
document_.AddMember("bytes", bytes, alloc);
document_.AddMember("collections", collections, alloc);
}

virtual ~Memory() { }

virtual void update() {
document_["objects"] = objects_;
document_["bytes"] = bytes_;
document_["collections"] = collections_;
document_["objects"] = objects;
document_["bytes"] = bytes;
document_["collections"] = collections;
}
};

class CodeManager : public Memory {
public:
int64_t chunks_;
int64_t chunks;

CodeManager()
: Memory()
, chunks_(0)
, chunks(0)
{
set_type("CodeManager");

document_.AddMember("chunks", chunks_, document_.GetAllocator());
document_.AddMember("chunks", chunks, document_.GetAllocator());
}

virtual void update() {
document_["chunks"] = chunks_;
document_["chunks"] = chunks;
}
};

Expand All @@ -65,35 +65,35 @@ namespace rubinius {

class Immix : public Memory {
public:
int64_t total_bytes_;
int64_t chunks_;
int64_t holes_;
double percentage_;
int64_t total_bytes;
int64_t chunks;
int64_t holes;
double percentage;

Immix()
: Memory()
, total_bytes_(0)
, chunks_(0)
, holes_(0)
, percentage_(0.0)
, total_bytes(0)
, chunks(0)
, holes(0)
, percentage(0.0)
{
set_type("ImmixCollector");

rapidjson::Document::AllocatorType& alloc = document_.GetAllocator();

document_.AddMember("total_bytes", total_bytes_, alloc);
document_.AddMember("chunks", chunks_, alloc);
document_.AddMember("holes", holes_, alloc);
document_.AddMember("percentage", percentage_, alloc);
document_.AddMember("total_bytes", total_bytes, alloc);
document_.AddMember("chunks", chunks, alloc);
document_.AddMember("holes", holes, alloc);
document_.AddMember("percentage", percentage, alloc);
}

virtual void update() {
Memory::update();

document_["total_bytes"] = total_bytes_;
document_["chunks"] = chunks_;
document_["holes"] = holes_;
document_["percentage"] = percentage_;
document_["total_bytes"] = total_bytes;
document_["chunks"] = chunks;
document_["holes"] = holes;
document_["percentage"] = percentage;
}
};

Expand Down
1 change: 1 addition & 0 deletions machine/diagnostics/profiler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ namespace rubinius {
}
};

private:
std::unordered_map<uint64_t, IndexEntry> index_;
std::unordered_map<ProfilerEntryKey, Entry> entries_;

Expand Down
8 changes: 4 additions & 4 deletions machine/memory/code_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ namespace memory {
if(!current_chunk_) {
add_chunk();
*collect_now = true;
diagnostic()->collections_++;
diagnostic()->collections++;
}
}
}
Expand All @@ -108,8 +108,8 @@ namespace memory {
chunk_used = true;
cr->clear_mark();

diagnostic()->objects_++;
diagnostic()->bytes_ += cr->size();
diagnostic()->objects++;
diagnostic()->bytes += cr->size();
}
}
}
Expand All @@ -136,7 +136,7 @@ namespace memory {
} else {
prev = chunk;
chunk = chunk->next;
diagnostic()->chunks_++;
diagnostic()->chunks++;
}
}
}
Expand Down
Loading

0 comments on commit 0f32aad

Please sign in to comment.