Skip to content

Commit

Permalink
Showing 3 changed files with 22 additions and 49 deletions.
26 changes: 7 additions & 19 deletions machine/diagnostics.cpp
Original file line number Diff line number Diff line change
@@ -12,44 +12,32 @@
namespace rubinius {
namespace diagnostics {
DiagnosticsData::DiagnosticsData()
: document_(new rapidjson::Document())
: document()
{
/*
document_->SetObject();
document.SetObject();

document_->AddMember("diagnostic_type",
rapidjson::Value("DiagnosticsData"), document_->GetAllocator());
*/
}

DiagnosticsData::~DiagnosticsData() {
if(document_) delete document_;
document.AddMember("diagnostic_type", "DiagnosticsData", document.GetAllocator());
}

void DiagnosticsData::set_type(const char* type) {
(*document_)["diagnostic_type"].SetString(type, document_->GetAllocator());
document["diagnostic_type"].SetString(type, document.GetAllocator());
}

void DiagnosticsData::to_string(rapidjson::StringBuffer& buffer) {
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);

document_->Accept(writer);
document.Accept(writer);
}

MemoryDiagnostics::MemoryDiagnostics()
: DiagnosticsData()
, objects_(0)
, bytes_(0)
{
/*
set_type("MemoryDiagnostics");

document()->AddMember("objects",
rapidjson::Value(objects_), document()->GetAllocator());
document()->AddMember("bytes",
rapidjson::Value(bytes_), document()->GetAllocator());
*/
document.AddMember("objects", objects_, document.GetAllocator());
document.AddMember("bytes", bytes_, document.GetAllocator());
}

FileEmitter::FileEmitter(STATE, std::string path)
10 changes: 3 additions & 7 deletions machine/diagnostics.hpp
Original file line number Diff line number Diff line change
@@ -14,15 +14,11 @@
namespace rubinius {
namespace diagnostics {
class DiagnosticsData {
rapidjson::Document* document_;

public:
DiagnosticsData();
virtual ~DiagnosticsData();
rapidjson::Document document;

rapidjson::Document* document() {
return document_;
}
DiagnosticsData();
virtual ~DiagnosticsData() { }

virtual void update() { }

35 changes: 12 additions & 23 deletions machine/memory/immix_collector.cpp
Original file line number Diff line number Diff line change
@@ -22,35 +22,24 @@ namespace memory {
, holes_(0)
, percentage_(0.0)
{
/*
set_type("ImmixCollector");

document()->AddMember("collections",
rapidjson::Value(collections_), document()->GetAllocator());
document()->AddMember("total_bytes",
rapidjson::Value(total_bytes_), document()->GetAllocator());
document()->AddMember("chunks",
rapidjson::Value(chunks_), document()->GetAllocator());
document()->AddMember("holes",
rapidjson::Value(holes_), document()->GetAllocator());
document()->AddMember("percentage",
rapidjson::Value(percentage_), document()->GetAllocator());
*/
document.AddMember("collections", collections_, document.GetAllocator());
document.AddMember("total_bytes", total_bytes_, document.GetAllocator());
document.AddMember("chunks", chunks_, document.GetAllocator());
document.AddMember("holes", holes_, document.GetAllocator());
document.AddMember("percentage", percentage_, document.GetAllocator());
}


void ImmixGC::Diagnostics::update() {
(*document())["objects"] = objects_;
(*document())["bytes"] = bytes_;
(*document())["collections"] = collections_;
(*document())["total_bytes"] = total_bytes_;
(*document())["chunks"] = chunks_;
(*document())["holes"] = holes_;
(*document())["percentage"] = percentage_;
document["objects"] = objects_;
document["bytes"] = bytes_;
document["collections"] = collections_;
document["total_bytes"] = total_bytes_;
document["chunks"] = chunks_;
document["holes"] = holes_;
document["percentage"] = percentage_;
}

void ImmixGC::ObjectDescriber::added_chunk(int count) {

0 comments on commit d525185

Please sign in to comment.