From 8174cceb14b39091500f6f3562987c5570462f87 Mon Sep 17 00:00:00 2001 From: Craig Tiller Date: Wed, 1 Mar 2017 15:38:41 -0800 Subject: [PATCH] Generate CSV file --- test/core/memory_usage/client.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/core/memory_usage/client.c b/test/core/memory_usage/client.c index 09f0e2d8670..c33ffbb0a0a 100644 --- a/test/core/memory_usage/client.c +++ b/test/core/memory_usage/client.c @@ -310,6 +310,26 @@ int main(int argc, char **argv) { server_calls_end.total_size_relative - after_server_create.total_size_relative); + const char *csv_file = "memory_usage.csv"; + FILE *csv = fopen(csv_file, "w"); + if (csv) { + fprintf(csv, "%f,%zi,%zi,%f,%zi\n", + (double)(client_calls_inflight.total_size_relative - + client_benchmark_calls_start.total_size_relative) / + benchmark_iterations, + client_channel_end.total_size_relative - + client_channel_start.total_size_relative, + after_server_create.total_size_relative - + before_server_create.total_size_relative, + (double)(server_calls_inflight.total_size_relative - + server_benchmark_calls_start.total_size_relative) / + benchmark_iterations, + server_calls_end.total_size_relative - + after_server_create.total_size_relative); + fclose(csv); + gpr_log(GPR_INFO, "Summary written to %s", csv_file); + } + grpc_memory_counters_destroy(); return 0; }