Reduce static array size 17/243617/1
authorDewal Agarwal <d1.agarwal@samsung.com>
Tue, 8 Sep 2020 12:12:54 +0000 (17:42 +0530)
committerDewal Agarwal <d1.agarwal@samsung.com>
Tue, 8 Sep 2020 12:12:54 +0000 (17:42 +0530)
Change-Id: I7e3f9eb47cefbeed756a3c24968e19225a606967
Signed-off-by: Dewal Agarwal <d1.agarwal@samsung.com>
include/bd_history_item.h
src/battery_dump/bd_history_item.c

index 19876fd..b1209e1 100644 (file)
@@ -82,7 +82,7 @@ typedef struct _encoding_map_s {
 } encoding_map_s;
 */
 
-#define HISTORY_SIZE_MAX 1000000 // Maximum Allowed History
+#define HISTORY_SIZE_MAX 100000 // Maximum Allowed History
 #define TIZEN_DUMP_VERSION "9"
 #define DUMP_DATA_TAG "h"
 #define DUMP_DATA_TAG_1 "hsp"
index 2f38637..8fe92e8 100644 (file)
@@ -1337,7 +1337,7 @@ static int bd_set_history_from_listener(history_item_s* nrec)
        struct timeval tv;
        gettimeofday(&tv, NULL);
 
-       time_t current_time = tv.tv_sec;
+//     time_t current_time = tv.tv_sec;
 
 #ifdef DUMP_DUMMY
        history_data[h_count].time_s = nrec->time_s;
@@ -1396,16 +1396,25 @@ static int bd_set_history_from_listener(history_item_s* nrec)
                h_count++;
        else {
                // FIXME modify 1st argument (fd)
-               int ret = bd_print_history_item_main(-1, 0, current_time, 1);
+/*             int ret = bd_print_history_item_main(-1, 0, current_time, 1);
                if (ret != BATTERY_MONITOR_ERROR_NONE) {
                        h_count = 0;
                        return ret;
                }
-               ret = bd_free_history_data_memory();
+*/
+               int ret = bd_free_history_data_memory();
                if (ret != BATTERY_MONITOR_ERROR_NONE) {
                        _WARN("Error while memory free %x", ret);
                        return ret;
                }
+               history_item_s ts;
+               ret = bd_print_history_item_reset(&ts);
+               if (ret == BATTERY_MONITOR_ERROR_NONE) {
+                       ts.cmd_s = CM_CRR_TIME;
+                       ret = bd_store_history_item(&ts);
+                       if (ret != BATTERY_MONITOR_ERROR_NONE)
+                               _WARN("Init Node addition failed");
+               }
        }
 
        EXIT;