summaryrefslogtreecommitdiff
path: root/tools/stats_log_api_gen/main.cpp
diff options
context:
space:
mode:
authorYao Chen <yaochen@google.com>2018-08-22 14:11:51 -0700
committerYao Chen <yaochen@google.com>2018-08-22 14:21:42 -0700
commit0f5d661803810264a04a0ba7640f7730326a98a9 (patch)
treef342afa107e524cfb23a3cac4f7c718d21abe663 /tools/stats_log_api_gen/main.cpp
parent40613508cc058a5ff04309cc77b3f676fda4a139 (diff)
Add more accurate logging for stats log loss.
+ Only record eventual failure after the retries to get a accurate log loss count. + Record all types of failures which lead to log loss + Change the timestamp from elapsedRealtime to wallclock time for easier debugging server side + Also log the count too. Bug: 80538532 Test: manually tested Change-Id: I4fcccae3fa39c9e280a842e27c6432bb0a090b85
Diffstat (limited to 'tools/stats_log_api_gen/main.cpp')
-rw-r--r--tools/stats_log_api_gen/main.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/tools/stats_log_api_gen/main.cpp b/tools/stats_log_api_gen/main.cpp
index e519909aa026..8038a3a4f44e 100644
--- a/tools/stats_log_api_gen/main.cpp
+++ b/tools/stats_log_api_gen/main.cpp
@@ -349,8 +349,7 @@ static int write_stats_log_cpp(FILE *out, const Atoms &atoms,
argIndex++;
}
fprintf(out, ");\n");
- fprintf(out, " if (ret >= 0) { return retry; }\n");
-
+ fprintf(out, " if (ret >= 0) { break; }\n");
fprintf(out, " {\n");
fprintf(out, " std::lock_guard<std::mutex> lock(mLogdRetryMutex);\n");
@@ -360,6 +359,9 @@ static int write_stats_log_cpp(FILE *out, const Atoms &atoms,
fprintf(out, " }\n");
fprintf(out, " std::this_thread::sleep_for(std::chrono::milliseconds(10));\n");
fprintf(out, " }\n");
+ fprintf(out, " if (ret < 0) {\n");
+ fprintf(out, " note_log_drop();\n");
+ fprintf(out, " }\n");
fprintf(out, " return ret;\n");
fprintf(out, "}\n");
fprintf(out, "\n");
@@ -439,7 +441,7 @@ static int write_stats_log_cpp(FILE *out, const Atoms &atoms,
argIndex++;
}
fprintf(out, ");\n");
- fprintf(out, " if (ret >= 0) { return retry; }\n");
+ fprintf(out, " if (ret >= 0) { break; }\n");
fprintf(out, " {\n");
fprintf(out, " std::lock_guard<std::mutex> lock(mLogdRetryMutex);\n");
@@ -450,7 +452,10 @@ static int write_stats_log_cpp(FILE *out, const Atoms &atoms,
fprintf(out, " std::this_thread::sleep_for(std::chrono::milliseconds(10));\n");
fprintf(out, " }\n");
- fprintf(out, " return ret;\n");
+ fprintf(out, " if (ret < 0) {\n");
+ fprintf(out, " note_log_drop();\n");
+ fprintf(out, " }\n");
+ fprintf(out, " return ret;\n\n");
fprintf(out, "}\n");
fprintf(out, "\n");