#include <stdio.h>
#include <stdlib.h>
#include <glib.h>
+#include <sys/time.h>
#include "proc-common.h"
#include "notifier.h"
#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,
#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;
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);