BuildRequires: pkgconfig(gio-2.0)
BuildRequires: pkgconfig(pkgmgr-info)
BuildRequires: pkgconfig(crash-service)
+BuildRequires: pkgconfig(dlog)
ExclusiveArch: armv7l
Requires: %{KMOD_PATH}
/* Kill the process */
if (ad->ds->process->kill) {
- _D_PROC(ad->ds->process, "Killing process");
+ _I_PROC(ad->ds->process, "Killing process");
if (kill(ad->ds->process->pid, SIGKILL))
_E("Unable to kill process %s(%d): %m",
ad->ds->process->name,
if (signal_params) {
dbus_send_signal(objpath, interface, "AbnormalityDetected", signal_params);
- _D_PROC(ad->ds->process, "Sent D-Bus signal (%s, %s)",
+ _I_PROC(ad->ds->process, "Sent D-Bus signal (%s, %s)",
limit_type_to_string(ad->lt),
ad->ds->param_name);
} else {
_E("livedump_pid() failed (for more info please check 'dlogutil LIBCRASH-SERVICE' and/or 'dlogutil CRASH_MANAGER'");
ad->report_path[0] = 0;
} else {
- _D_PROC(ad->ds->process, "Received report: %s", ad->report_path);
+ _I_PROC(ad->ds->process, "Received report: %s", ad->report_path);
}
action_finish(ad);
return 0;
ds->action_in_progress = 1;
- _D_PROC(ds->process, "Running default action");
+ _I_PROC(ds->process, "Running default action");
ad = calloc(1, sizeof(*ad));
if (!ad) {
return;
if (process->class != old_class)
- _D_PROC(process, "Class changed");
+ _I_PROC(process, "Class changed");
} else {
_W("Received AUL status update for PID %d, but it wasn't found in internal state - ignoring.", pid);
if (!config)
return -EINVAL;
- _D("Loaded config %s\n", config_file);
+ _D("Loaded config %s", config_file);
return 0;
}
}
}
- _D("Loaded config %s\n", config_file);
+ _D("Loaded config %s", config_file);
return 0;
}
}
data_sources[data_sources_n++] = mod;
- _D("Registered data source: %s\n", mod->name);
+ _I("Registered data source: %s", mod->name);
return 0;
}
if (ced->cpu_time < ced->cpu_time_last) {
- _D_PROC(ds->process, "cpu_time < cpu_time_last, ignoring sample");
+ _I_PROC(ds->process, "cpu_time < cpu_time_last, ignoring sample");
return 0;
}
}
if (ied->io_bytes < ied->io_bytes_last) {
- _D_PROC(ds->process, "io_bytes < io_bytes_last, ignoring sample");
+ _I_PROC(ds->process, "io_bytes < io_bytes_last, ignoring sample");
return 0;
}
goto cleanup;
}
- _DD("Emitted signal\n"
- " objpath: %s\n"
- " interface: %s\n"
- " member: %s\n"
- " parameters: %s\n",
- object_path, interface_name, signal_name, parameters_str);
+ _D("Emitted signal\n"
+ " objpath: %s\n"
+ " interface: %s\n"
+ " member: %s\n"
+ " parameters: %s\n",
+ object_path, interface_name, signal_name, parameters_str);
cleanup:
g_free(parameters_str);
#define LOG_H
#include <stdio.h>
+#include <dlog.h>
#include "utils.h"
#include "process.h"
-#define print(fmt, arg...) \
- printf(fmt, ##arg); \
+#define TAG "STABILITY_MONITOR"
+
+#define print(lvl, fmt, arg...) \
+ dlog_print(lvl, TAG, fmt, ##arg); \
log_inc_msg_count()
-#define _E(fmt, arg...) do { \
- print("ERROR: %s::%s(%d): " fmt "\n", __FILE__, __FUNCTION__, __LINE__, ##arg); \
+#define _E(fmt, arg...) do { \
+ print(DLOG_ERROR, "%s::%s(%d): " fmt, __FILE__, __FUNCTION__, __LINE__, ##arg); \
} while (0)
-#define _W(fmt, arg...) do { \
- print("WARN: %s::%s(%d): " fmt "\n", __FILE__, __FUNCTION__, __LINE__, ##arg); \
+#define _W(fmt, arg...) do { \
+ print(DLOG_WARN, "%s::%s(%d): " fmt, __FILE__, __FUNCTION__, __LINE__, ##arg); \
} while (0)
-#define _D(fmt, arg...) do { \
- print(fmt, ##arg); \
+#define _I(fmt, arg...) do { \
+ print(DLOG_INFO, fmt, ##arg); \
} while (0)
-#define _DD(fmt, arg...) do { \
- /* TODO */ \
+#define _D(fmt, arg...) do { \
+ print(DLOG_DEBUG, fmt, ##arg); \
} while (0)
-#define _D_PROC(process, fmt, arg...) \
- _D("(%d)\t[%-25.25s | %-21s ] " fmt "\n", \
+#define _I_PROC(process, fmt, arg...) \
+ _I("(%d)\t[%-25.25s | %-21s ] " fmt, \
process->pid, \
process->name, \
process_class_to_string(process->class), \
process_ref(p);
if (p->monitor)
- _D_PROC(p, "Created process");
+ _I_PROC(p, "Created process");
return 0;
}
/* Peak limit */
if (sample_is_greater(last_sample, &ds->limit.peak)) {
- _D_PROC(process, "%s: PEAK limit exceeded (%s)",
+ _I_PROC(process, "%s: PEAK limit exceeded (%s)",
ds->name, smpl2str(last_sample));
ds->action(ds, LIMIT_TYPE_PEAK);
/* Avg limit */
if (sc->average > ds->limit.avg) {
- _D_PROC(process, "%s: AVG limit exceeded (%2.3lf)",
+ _I_PROC(process, "%s: AVG limit exceeded (%2.3lf)",
ds->name, sc->average);
ds->action(ds, LIMIT_TYPE_AVG);
for (int i = 0; i < header_lines; i++) {
header_items[(ds_n + 1) * i + ds_n] = NULL;
str = g_strjoinv(NULL, &header_items[(ds_n + 1) * i]);
- _D_PROC(process, "%s", str);
+ _I_PROC(process, "%s", str);
g_free(str);
}
state_items[ds_n] = NULL;
state_msg = g_strjoinv(NULL, state_items);
- _D_PROC(process, "%s", state_msg);
+ _I_PROC(process, "%s", state_msg);
g_strfreev(state_items);
g_free(state_msg);
process->ref_count--;
if (process->ref_count <= 0) {
if (process->monitor)
- _D_PROC(process, "Removing process");
+ _I_PROC(process, "Removing process");
process_cleanup(process);
}
}
/* TODO: Check name */
rdp = mod;
- _D("Registered raw data provider: %s\n", mod->name);
+ _I("Registered raw data provider: %s", mod->name);
return 0;
}
ret = str_to_ullarray(buf, rd_i->v);
if (ret <= 0) {
- _E("Unable to parse raw data from kernel: \"%s\"\n", buf);
+ _E("Unable to parse raw data from kernel: \"%s\"", buf);
goto error;
}
}
int fd, ret = 0;
if (access(PROC_TSM_PATH, O_RDONLY) == 0) {
- _D("Kernel module already loaded\n");
+ _I("Kernel module already loaded");
return 0;
}
struct sample_s *sample;
list_for_each_entry(sample, list, node) {
- _D("sample %p\n", sample);
+ _I("sample %p", sample);
}
}
static gboolean signal_handler(GMainLoop *loop, const char *sig_name)
{
- _D("\nReceived %s, exit\n", sig_name);
+ _I("\nReceived %s, exit", sig_name);
g_main_loop_quit(loop);
return FALSE;
}
ret = process_create_info(rd_i->v[0], rd_i->v[1], &process);
if (ret) {
if (ret == -EEXIST)
- _DD("Unable to create process info, it has just died\n");
+ _D("Unable to create process info, it has just died\n");
else
_E("Unable to create process info: %d", ret);
cleanup:
raw_data_cleanup(&rd);
- // _D("Run took %lf s\n", (double) 1. * (time_now() - _t) / USEC_PER_SEC);
+ // _D("Run took %lf s", (double) 1. * (time_now() - _t) / USEC_PER_SEC);
return TRUE;
}
* which readlink never appends on its own) */
ret = readlink(link_name, path, sizeof(path) - 1);
if (ret <= 0) {
- _DD("readlink() failed, pid: %d, ret: %d\n", pid, ret);
+ _D("readlink() failed, pid: %d, %m", pid);
return -EEXIST;
}