aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <rostedt@goodmis.org>2016-02-01 22:06:27 -0500
committerSteven Rostedt <rostedt@goodmis.org>2016-02-09 22:11:51 -0500
commitccdd17d99e3976167ad59dfb98256c6ef193f469 (patch)
tree28e06d61d5df3310187313ad7e5b08b12efa2dce
parent820dc815193e782af3b4949a376f23163c6cff81 (diff)
downloadtrace-cmd-ccdd17d99e3976167ad59dfb98256c6ef193f469.tar.gz
kernelshark: Clean up some of the code warnings
There were several code warnings while compiling. Clean most of them up. Some were not cleaned up because the unused code is there as a place holder for future development. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--kernel-shark.c19
-rw-r--r--trace-capture.c4
-rw-r--r--trace-dialog.c4
-rw-r--r--trace-graph.c8
-rw-r--r--trace-plot-cpu.c14
-rw-r--r--trace-view-store.c9
6 files changed, 16 insertions, 42 deletions
diff --git a/kernel-shark.c b/kernel-shark.c
index 02014274..bd30d4fd 100644
--- a/kernel-shark.c
+++ b/kernel-shark.c
@@ -221,10 +221,13 @@ static void update_title(GtkWidget *window, const gchar *file)
{
GString *gstr;
gchar *str;
+ gchar *gfile;
+ gfile = g_strdup(file);
gstr = g_string_new("kernelshark");
- g_string_append_printf(gstr, "(%s)", basename(file));
+ g_string_append_printf(gstr, "(%s)", basename(gfile));
str = g_string_free(gstr, FALSE);
+ g_free(gfile);
gtk_window_set_title(GTK_WINDOW(window), str);
g_free(str);
@@ -743,7 +746,6 @@ sync_task_filter_clicked (GtkWidget *subitem, gpointer data)
struct filter_task *hide_tasks;
GtkTreeView *trace_tree = GTK_TREE_VIEW(info->treeview);
GtkTreeModel *model;
- TraceViewStore *store;
gboolean keep;
gchar *selections[] = { "Sync List Filter with Graph Filter",
"Sync Graph Filter with List Filter",
@@ -761,8 +763,6 @@ sync_task_filter_clicked (GtkWidget *subitem, gpointer data)
if (!model)
return;
- store = TRACE_VIEW_STORE(model);
-
/* If they are already equal, then just perminently sync them */
if (filter_task_compare(info->ginfo->task_filter,
info->list_task_filter) &&
@@ -894,7 +894,6 @@ __update_list_task_filter_callback(struct shark_info *info,
{
GtkTreeView *trace_tree = GTK_TREE_VIEW(info->treeview);
GtkTreeModel *model;
- TraceViewStore *store;
int i;
if (!accept)
@@ -904,8 +903,6 @@ __update_list_task_filter_callback(struct shark_info *info,
if (!model)
return;
- store = TRACE_VIEW_STORE(model);
-
filter_task_clear(task_filter);
if (selected) {
@@ -955,7 +952,6 @@ __list_tasks_clicked (struct shark_info *info,
GtkTreeView *trace_tree = GTK_TREE_VIEW(info->treeview);
struct graph_info *ginfo = info->ginfo;
GtkTreeModel *model;
- TraceViewStore *store;
gint *selected;
gint *tasks;
@@ -966,8 +962,6 @@ __list_tasks_clicked (struct shark_info *info,
if (!model)
return;
- store = TRACE_VIEW_STORE(model);
-
tasks = trace_graph_task_list(ginfo);
selected = filter_task_pids(task_filter);
@@ -1521,7 +1515,6 @@ do_tree_popup(GtkWidget *widget, GdkEventButton *event, gpointer data)
GtkTreeModel *model;
const char *comm;
gint pid;
- gint len;
guint64 offset;
gint row;
gint cpu;
@@ -1608,8 +1601,6 @@ do_tree_popup(GtkWidget *widget, GdkEventButton *event, gpointer data)
pid = pevent_data_pid(ginfo->pevent, record);
comm = pevent_data_comm_from_pid(ginfo->pevent, pid);
- len = strlen(comm) + 50;
-
if (info->sync_task_filters) {
if (trace_graph_filter_task_find_pid(ginfo, pid))
set_menu_label(menu_filter_add_task, comm, pid,
@@ -1773,7 +1764,9 @@ void kernel_shark(int argc, char **argv)
int ret;
int c;
+#if !GLIB_CHECK_VERSION(2, 32, 0)
g_thread_init(NULL);
+#endif
gdk_threads_init();
gtk_init(&argc, &argv);
diff --git a/trace-capture.c b/trace-capture.c
index 900a745e..004f1d61 100644
--- a/trace-capture.c
+++ b/trace-capture.c
@@ -83,8 +83,6 @@ static int is_just_ws(const char *str)
return !str[i];
}
-static gboolean settings_saved;
-
static GString *get_home_settings_new(void)
{
char *path = getenv("HOME");
@@ -1584,7 +1582,7 @@ static void tracing_dialog(struct shark_info *info, const char *tracing)
void tracecmd_capture_clicked(gpointer data)
{
struct shark_info *info = data;
- char *tracing;
+ const char *tracing;
tracing = tracecmd_get_tracing_dir();
diff --git a/trace-dialog.c b/trace-dialog.c
index f7f4d49d..0b71138b 100644
--- a/trace-dialog.c
+++ b/trace-dialog.c
@@ -209,9 +209,9 @@ void warning(const char *fmt, ...)
g_string_append(str, "\n");
- if (errno) {
+ if (err) {
g_string_prepend(str, "\n");
- g_string_prepend(str, strerror(errno));
+ g_string_prepend(str, strerror(err));
}
errno = 0;
diff --git a/trace-graph.c b/trace-graph.c
index 4815fe1f..0a808636 100644
--- a/trace-graph.c
+++ b/trace-graph.c
@@ -1213,16 +1213,13 @@ static void draw_info_box(struct graph_info *ginfo, const gchar *buffer,
static void draw_plot_info(struct graph_info *ginfo, struct graph_plot *plot,
gint x, gint y)
{
- struct pevent *pevent;
- guint64 time;
unsigned long sec, usec;
struct trace_seq s;
+ guint64 time;
time = convert_x_to_time(ginfo, x);
convert_nano(time, &sec, &usec);
- pevent = ginfo->pevent;
-
trace_seq_init(&s);
dprintf(3, "start=%llu end=%llu time=%llu\n",
@@ -1243,7 +1240,6 @@ static void draw_plot_info(struct graph_info *ginfo, struct graph_plot *plot,
static void draw_latency(struct graph_info *ginfo, gint x, gint y)
{
- struct pevent *pevent;
unsigned long sec, usec;
struct trace_seq s;
gboolean neg;
@@ -1262,8 +1258,6 @@ static void draw_latency(struct graph_info *ginfo, gint x, gint y)
convert_nano(time, &sec, &usec);
- pevent = ginfo->pevent;
-
trace_seq_init(&s);
trace_seq_printf(&s, "Diff: %s%ld.%06lu secs", neg ? "-":"", sec, usec);
diff --git a/trace-plot-cpu.c b/trace-plot-cpu.c
index bb767d3c..a14712e3 100644
--- a/trace-plot-cpu.c
+++ b/trace-plot-cpu.c
@@ -194,9 +194,7 @@ static void cpu_plot_start(struct graph_info *ginfo, struct graph_plot *plot,
unsigned long long time)
{
struct cpu_plot_info *cpu_info = plot->private;
- int cpu;
- cpu = cpu_info->cpu;
cpu_info->last_time = 0ULL;
cpu_info->last_pid = -1;
free_record(cpu_info->last_record);
@@ -209,7 +207,6 @@ static void update_last_record(struct graph_info *ginfo,
{
struct tracecmd_input *handle = ginfo->handle;
struct pevent_record *trecord;
- int filter;
int sched_pid;
int orig_pid;
int is_sched_switch;
@@ -226,9 +223,9 @@ static void update_last_record(struct graph_info *ginfo,
if (!trecord)
return;
- filter = filter_record(ginfo, trecord,
- &orig_pid, &sched_pid,
- &is_sched_switch);
+ filter_record(ginfo, trecord,
+ &orig_pid, &sched_pid,
+ &is_sched_switch);
cpu_info->last_pid = is_sched_switch ? sched_pid : orig_pid;
cpu_info->last_record = trecord;
cpu_info->last_time = trecord->ts;
@@ -249,11 +246,8 @@ static int cpu_plot_event(struct graph_info *ginfo,
int filter;
int box_filter;
int pid;
- int cpu;
int ret = 1;
- cpu = cpu_info->cpu;
-
if (!record) {
if (!cpu_info->last_record)
update_last_record(ginfo, cpu_info, record);
@@ -283,8 +277,6 @@ static int cpu_plot_event(struct graph_info *ginfo,
cpu_info->last_record = record;
tracecmd_record_ref(record);
- cpu = cpu_info->cpu;
-
filter = filter_record(ginfo, record, &orig_pid, &sched_pid, &is_sched_switch);
/* set pid to record, or next task on sched_switch */
diff --git a/trace-view-store.c b/trace-view-store.c
index f3a4c654..2ec52c88 100644
--- a/trace-view-store.c
+++ b/trace-view-store.c
@@ -1156,9 +1156,8 @@ gint trace_view_store_get_num_actual_rows(TraceViewStore *store)
gint get_next_pid(TraceViewStore *store, struct pevent *pevent, struct pevent_record *record)
{
unsigned long long val;
- int ret;
- ret = pevent_read_number_field(store->sched_switch_next_field, record->data, &val);
+ pevent_read_number_field(store->sched_switch_next_field, record->data, &val);
return val;
}
@@ -1166,9 +1165,8 @@ gint get_next_pid(TraceViewStore *store, struct pevent *pevent, struct pevent_re
gint get_wakeup_pid(TraceViewStore *store, struct pevent *pevent, struct pevent_record *record)
{
unsigned long long val;
- int ret;
- ret = pevent_read_number_field(store->sched_wakeup_pid_field, record->data, &val);
+ pevent_read_number_field(store->sched_wakeup_pid_field, record->data, &val);
return val;
}
@@ -1176,9 +1174,8 @@ gint get_wakeup_pid(TraceViewStore *store, struct pevent *pevent, struct pevent_
gint get_wakeup_new_pid(TraceViewStore *store, struct pevent *pevent, struct pevent_record *record)
{
unsigned long long val;
- int ret;
- ret = pevent_read_number_field(store->sched_wakeup_new_pid_field, record->data, &val);
+ pevent_read_number_field(store->sched_wakeup_new_pid_field, record->data, &val);
return val;
}