Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fixup! report: include information about event loop itself
  • Loading branch information
addaleax committed Feb 5, 2019
commit 2b67f5be6eedf40b1863687fed6f2fd2e7c4c160
2 changes: 1 addition & 1 deletion doc/api/report.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ is provided below for reference.
{
"type": "loop",
"is_active": true,
"address": "140696384399248"
"address": "0x000055fc7b2cb180"
}
],
"environmentVariables": {
Expand Down
2 changes: 1 addition & 1 deletion src/node_report.cc
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ static void WriteNodeReport(Isolate* isolate,
writer.json_keyvalue("is_active",
static_cast<bool>(uv_loop_alive(env->event_loop())));
writer.json_keyvalue("address",
std::to_string(reinterpret_cast<int64_t>(env->event_loop())));
ValueToHexString(reinterpret_cast<int64_t>(env->event_loop())));
writer.json_end();
}

Expand Down
9 changes: 8 additions & 1 deletion src/node_report.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,15 @@ void GetNodeReport(v8::Isolate* isolate,
void ReportEndpoints(uv_handle_t* h, std::ostringstream& out);
void WalkHandle(uv_handle_t* h, void* arg);
std::string EscapeJsonChars(const std::string& str);

template <typename T>
std::string ValueToHexString(T value);
std::string ValueToHexString(T value) {
std::stringstream hex;

hex << "0x" << std::setfill('0') << std::setw(sizeof(T) * 2) << std::hex <<
value;
return hex.str();
}

// Function declarations - export functions in src/node_report_module.cc
void TriggerReport(const v8::FunctionCallbackInfo<v8::Value>& info);
Expand Down
9 changes: 0 additions & 9 deletions src/node_report_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,6 @@ void WalkHandle(uv_handle_t* h, void* arg) {
writer->json_end();
}

template <typename T>
std::string ValueToHexString(T value) {
std::stringstream hex;

hex << "0x" << std::setfill('0') << std::setw(sizeof(T) * 2) << std::hex <<
value;
return hex.str();
}

std::string EscapeJsonChars(const std::string& str) {
const std::string control_symbols[0x20] = {
"\\u0000", "\\u0001", "\\u0002", "\\u0003", "\\u0004", "\\u0005",
Expand Down