From 2b67f5be6eedf40b1863687fed6f2fd2e7c4c160 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Tue, 5 Feb 2019 18:29:05 +0100 Subject: [PATCH] fixup! report: include information about event loop itself --- doc/api/report.md | 2 +- src/node_report.cc | 2 +- src/node_report.h | 9 ++++++++- src/node_report_utils.cc | 9 --------- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/doc/api/report.md b/doc/api/report.md index bf86a5075dcd0e..3937f88cc1be4a 100644 --- a/doc/api/report.md +++ b/doc/api/report.md @@ -219,7 +219,7 @@ is provided below for reference. { "type": "loop", "is_active": true, - "address": "140696384399248" + "address": "0x000055fc7b2cb180" } ], "environmentVariables": { diff --git a/src/node_report.cc b/src/node_report.cc index c53810b63b270d..7477a2fd240513 100644 --- a/src/node_report.cc +++ b/src/node_report.cc @@ -319,7 +319,7 @@ static void WriteNodeReport(Isolate* isolate, writer.json_keyvalue("is_active", static_cast(uv_loop_alive(env->event_loop()))); writer.json_keyvalue("address", - std::to_string(reinterpret_cast(env->event_loop()))); + ValueToHexString(reinterpret_cast(env->event_loop()))); writer.json_end(); } diff --git a/src/node_report.h b/src/node_report.h index 9b67dcf1c5b305..eb38bee8c697f5 100644 --- a/src/node_report.h +++ b/src/node_report.h @@ -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 -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& info); diff --git a/src/node_report_utils.cc b/src/node_report_utils.cc index d013eb91677323..2a454fc37154f8 100644 --- a/src/node_report_utils.cc +++ b/src/node_report_utils.cc @@ -214,15 +214,6 @@ void WalkHandle(uv_handle_t* h, void* arg) { writer->json_end(); } -template -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",