Dump the elapsed time from last event 55/223355/4
authorKichan Kwon <k_c.kwon@samsung.com>
Wed, 29 Jan 2020 01:59:43 +0000 (10:59 +0900)
committerKichan Kwon <k_c.kwon@samsung.com>
Wed, 19 Feb 2020 05:17:48 +0000 (14:17 +0900)
- To show how long the last status is lasted

Change-Id: I2068cd897cd3baa90aebb4f6d60a9bbcf0a7dd0e
Signed-off-by: Kichan Kwon <k_c.kwon@samsung.com>
src/battery_dump/bd_history_item.c

index d14d570089e71577265466c193000185ae743425..b285c995c9a5300d57a41260441e86454d5db34a 100644 (file)
@@ -1024,6 +1024,25 @@ int bd_print_history_item_main(int fd, int num_h_items, long base_time, bool chk
                                _WARN("write error");
                        g_free(dump_p->str);
        }
+
+       // Dump the elapsed time from last event
+       // It should be dumped without storing
+       GString *dump_tmp_p = g_string_sized_new(30);
+       struct timeval tv;
+       gettimeofday(&tv, NULL);
+
+       dump_tmp_p = g_string_append(dump_tmp_p, TIZEN_DUMP_VERSION);
+       dump_tmp_p = g_string_append_c(dump_tmp_p, ',');
+       dump_tmp_p = g_string_append(dump_tmp_p, DUMP_DATA_TAG);
+       dump_tmp_p = g_string_append_c(dump_tmp_p, ',');
+       g_string_append_printf(dump_tmp_p, "%lld",
+                       ((long long)tv.tv_sec * 1000) + ((long long)tv.tv_usec / 1000) - old_state.time_s);
+       dump_tmp_p = g_string_append(dump_tmp_p, "\n");
+
+       if (write(fd, dump_tmp_p->str, dump_tmp_p->len) < 0)
+               _WARN("write error");
+       g_free(dump_tmp_p->str);
+
                //Dump i & l values after this
                ret = bd_get_and_print_uid_info_entry_from_dump(fd);
                if (ret != BATTERY_MONITOR_ERROR_NONE)