summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2019-02-03 15:10:19 +0100
committerAnna Henningsen <anna@addaleax.net>2019-02-06 15:36:24 +0100
commit91adbe14b4490483785e1cd094c1130278cd25f3 (patch)
tree5718fe59de72de50e1b067076803256f7bb5a3fc
parentb1f82e4342f8a630b1ef83cd33781a725428f569 (diff)
downloadandroid-node-v8-91adbe14b4490483785e1cd094c1130278cd25f3.tar.gz
android-node-v8-91adbe14b4490483785e1cd094c1130278cd25f3.tar.bz2
android-node-v8-91adbe14b4490483785e1cd094c1130278cd25f3.zip
report: include information about event loop itself
PR-URL: https://github.com/nodejs/node/pull/25906 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com>
-rw-r--r--doc/api/report.md5
-rw-r--r--src/node_report.cc11
-rw-r--r--src/node_report.h9
-rw-r--r--src/node_report_utils.cc9
4 files changed, 23 insertions, 11 deletions
diff --git a/doc/api/report.md b/doc/api/report.md
index a49d33d65e..3937f88cc1 100644
--- a/doc/api/report.md
+++ b/doc/api/report.md
@@ -215,6 +215,11 @@ is provided below for reference.
"is_referenced": false,
"address": "0x000000010188f2e0",
"details": ""
+ },
+ {
+ "type": "loop",
+ "is_active": true,
+ "address": "0x000055fc7b2cb180"
}
],
"environmentVariables": {
diff --git a/src/node_report.cc b/src/node_report.cc
index d10db1c97b..7477a2fd24 100644
--- a/src/node_report.cc
+++ b/src/node_report.cc
@@ -311,9 +311,18 @@ static void WriteNodeReport(Isolate* isolate,
#endif
writer.json_arraystart("libuv");
- if (env != nullptr)
+ if (env != nullptr) {
uv_walk(env->event_loop(), WalkHandle, static_cast<void*>(&writer));
+ writer.json_start();
+ writer.json_keyvalue("type", "loop");
+ writer.json_keyvalue("is_active",
+ static_cast<bool>(uv_loop_alive(env->event_loop())));
+ writer.json_keyvalue("address",
+ ValueToHexString(reinterpret_cast<int64_t>(env->event_loop())));
+ writer.json_end();
+ }
+
writer.json_arrayend();
// Report operating system information
diff --git a/src/node_report.h b/src/node_report.h
index 9b67dcf1c5..eb38bee8c6 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 <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);
diff --git a/src/node_report_utils.cc b/src/node_report_utils.cc
index d013eb9167..2a454fc371 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 <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",