diff options
author | jyotsna.a@samsung.com <jyotsna.a@samsung.com> | 2016-12-20 18:19:35 +0530 |
---|---|---|
committer | Michal Bloch <m.bloch@partner.samsung.com> | 2019-09-12 18:19:23 +0000 |
commit | ba5046c2f791dd076b969fdf13a11dea81c07422 (patch) | |
tree | 9205f3b9e4b63ebcaa6c5cd34379e9b9e5e10636 | |
parent | fba22da37d4739d3d9e05e1f9e9b90e3cf563d14 (diff) | |
download | resourced-ba5046c2f791dd076b969fdf13a11dea81c07422.tar.gz resourced-ba5046c2f791dd076b969fdf13a11dea81c07422.tar.bz2 resourced-ba5046c2f791dd076b969fdf13a11dea81c07422.zip |
heart: Notify SluggishFW on app malfunction detection
[Problem] New request from Tizen community
[Cause & Measure] Updating sluggish FW to support app malfunction reporting
Change-Id: If2a183a2504f29b30b03dcb969338e5dc89850a9
Signed-off-by: jyotsna.a@samsung.com <jyotsna.a@samsung.com>
-rw-r--r-- | src/heart/heart-abnormal.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/heart/heart-abnormal.c b/src/heart/heart-abnormal.c index 2636ec95..2aba308d 100644 --- a/src/heart/heart-abnormal.c +++ b/src/heart/heart-abnormal.c @@ -28,6 +28,7 @@ #include <stdio.h> #include <stdlib.h> #include <glib.h> +#include <sys/time.h> #include "proc-common.h" #include "notifier.h" @@ -44,6 +45,12 @@ #define ABNORMAL_DATA_MAX 1024 #define ABNORMAL_CHECK_NUM 10 +#define TIMESTAMP_LEN 16 +#define MILLISEC 1000 +#define TIME_MAX_LEN 64 +#define SLUG_TYPE_MALFUN "6" +#define NOPID "-" + enum abnormal_type { FC = 0, ANR = 1, @@ -154,6 +161,45 @@ static void heart_abnormal_launch_popup(char *appid, int count) #endif } +static int heart_abnormal_report_malfunction(char *name) +{ + int ret = -1; + char *param[5] = {0,}; + char timestr[TIMESTAMP_LEN] = {0,}; + char msgid[TIME_MAX_LEN] = {0,}; + char ts[TIME_MAX_LEN] = {0,}; + char pa1[TIMESTAMP_LEN] = {0,}; + char pa2[TIMESTAMP_LEN] = {0,}; + struct timeval time_of_day; + int milli; + time_t unix_time = time(NULL); + + if (gettimeofday(&time_of_day, NULL)) { + _E("gettimeofday failed"); + return ret; + } + + snprintf(timestr, sizeof(timestr), "%.10ld", unix_time); + milli = time_of_day.tv_usec / MILLISEC; + strftime(ts, TIME_MAX_LEN, "%Y.%m.%d-%H:%M:%S", localtime(&time_of_day.tv_sec)); + snprintf(msgid, sizeof(msgid), "%s+%d", ts, milli); + snprintf(pa1, TIMESTAMP_LEN, SLUG_TYPE_MALFUN); + snprintf(pa2, TIMESTAMP_LEN, NOPID); + + param[0] = pa1; + param[1] = pa2; + param[2] = name; + param[3] = timestr; + param[4] = msgid; + + ret = d_bus_call_method_async("org.tizen.system.crash", "/Org/Tizen/System/Crash/Crash", "org.tizen.system.crash.Crash", + "sluggish_dump", "iisss", param); + + if (ret < 0) + _E("Malfunction reporting to sluggish tool failed"); + return ret; +} + static void heart_abnormal_process_crashed(GVariant *params) { int ret, notify, count; @@ -195,6 +241,7 @@ static void heart_abnormal_process_crashed(GVariant *params) if (count > ABNORMAL_CHECK_NUM) { heart_abnormal_launch_popup(appid, count); notify = 1; + heart_abnormal_report_malfunction(appid); } g_hash_table_remove_all(heart_abnormal_list); |