-
- for (i = 0; i < num; i++)
- tree_view_column(tree_view, i, labels[i], ALIGN_RIGHT | UNSORTABLE);
-
- gtk_list_store_append(model, &iter);
-
- for (i = 0; i < num; i++) {
- char fbuf[32];
-
- if (lat[i] <= 0.0)
- sprintf(fbuf, "0.00");
- else
- sprintf(fbuf, "%3.2f%%", lat[i]);
-
- gtk_list_store_set(model, &iter, i, fbuf, -1);
- }
-
- return tree_view;
-}
-
-static void gfio_show_latency_buckets(GtkWidget *vbox, struct thread_stat *ts)
-{
- GtkWidget *box, *frame, *tree_view;
- double io_u_lat_u[FIO_IO_U_LAT_U_NR];
- double io_u_lat_m[FIO_IO_U_LAT_M_NR];
- const char *uranges[] = { "2", "4", "10", "20", "50", "100",
- "250", "500", "750", "1000", };
- const char *mranges[] = { "2", "4", "10", "20", "50", "100",
- "250", "500", "750", "1000", "2000",
- ">= 2000", };
-
- stat_calc_lat_u(ts, io_u_lat_u);
- stat_calc_lat_m(ts, io_u_lat_m);
-
- tree_view = gfio_output_lat_buckets(io_u_lat_u, FIO_IO_U_LAT_U_NR, uranges);
- if (tree_view) {
- frame = gtk_frame_new("Latency buckets (usec)");
- gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5);
-
- box = gtk_hbox_new(FALSE, 3);
- gtk_container_add(GTK_CONTAINER(frame), box);
- gtk_box_pack_start(GTK_BOX(box), tree_view, TRUE, FALSE, 3);
- }
-
- tree_view = gfio_output_lat_buckets(io_u_lat_m, FIO_IO_U_LAT_M_NR, mranges);
- if (tree_view) {
- frame = gtk_frame_new("Latency buckets (msec)");
- gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5);
-
- box = gtk_hbox_new(FALSE, 3);
- gtk_container_add(GTK_CONTAINER(frame), box);
- gtk_box_pack_start(GTK_BOX(box), tree_view, TRUE, FALSE, 3);
- }
-}
-
-static void gfio_show_cpu_usage(GtkWidget *vbox, struct thread_stat *ts)
-{
- GtkWidget *box, *frame, *entry;
- double usr_cpu, sys_cpu;
- unsigned long runtime;
- char tmp[32];
-
- runtime = ts->total_run_time;
- if (runtime) {
- double runt = (double) runtime;
-
- usr_cpu = (double) ts->usr_time * 100 / runt;
- sys_cpu = (double) ts->sys_time * 100 / runt;
- } else {
- usr_cpu = 0;
- sys_cpu = 0;
- }
-
- frame = gtk_frame_new("OS resources");
- gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5);
-
- box = gtk_hbox_new(FALSE, 3);
- gtk_container_add(GTK_CONTAINER(frame), box);
-
- entry = new_info_entry_in_frame(box, "User CPU");
- sprintf(tmp, "%3.2f%%", usr_cpu);
- gtk_entry_set_text(GTK_ENTRY(entry), tmp);
- entry = new_info_entry_in_frame(box, "System CPU");
- sprintf(tmp, "%3.2f%%", sys_cpu);
- gtk_entry_set_text(GTK_ENTRY(entry), tmp);
- entry = new_info_entry_in_frame(box, "Context switches");
- entry_set_int_value(entry, ts->ctx);
- entry = new_info_entry_in_frame(box, "Major faults");
- entry_set_int_value(entry, ts->majf);
- entry = new_info_entry_in_frame(box, "Minor faults");
- entry_set_int_value(entry, ts->minf);
-}
-static void gfio_add_sc_depths_tree(GtkListStore *model,
- struct thread_stat *ts, unsigned int len,
- int submit)
-{
- double io_u_dist[FIO_IO_U_MAP_NR];
- GtkTreeIter iter;
- /* Bits 0, and 3-8 */
- const int add_mask = 0x1f9;
- int i, j;
-
- if (submit)
- stat_calc_dist(ts->io_u_submit, ts->total_submit, io_u_dist);
- else
- stat_calc_dist(ts->io_u_complete, ts->total_complete, io_u_dist);
-
- gtk_list_store_append(model, &iter);
-
- gtk_list_store_set(model, &iter, 0, submit ? "Submit" : "Complete", -1);
-
- for (i = 1, j = 0; i < len; i++) {
- char fbuf[32];
-
- if (!(add_mask & (1UL << (i - 1))))
- sprintf(fbuf, "0.0%%");
- else {
- sprintf(fbuf, "%3.1f%%", io_u_dist[j]);
- j++;
- }
-
- gtk_list_store_set(model, &iter, i, fbuf, -1);
- }
-
-}
-
-static void gfio_add_total_depths_tree(GtkListStore *model,
- struct thread_stat *ts, unsigned int len)
-{
- double io_u_dist[FIO_IO_U_MAP_NR];
- GtkTreeIter iter;
- /* Bits 1-6, and 8 */
- const int add_mask = 0x17e;
- int i, j;
-
- stat_calc_dist(ts->io_u_map, ts_total_io_u(ts), io_u_dist);
-
- gtk_list_store_append(model, &iter);
-
- gtk_list_store_set(model, &iter, 0, "Total", -1);
-
- for (i = 1, j = 0; i < len; i++) {
- char fbuf[32];
-
- if (!(add_mask & (1UL << (i - 1))))
- sprintf(fbuf, "0.0%%");
- else {
- sprintf(fbuf, "%3.1f%%", io_u_dist[j]);
- j++;
- }
-
- gtk_list_store_set(model, &iter, i, fbuf, -1);
- }
-
-}
-
-static void gfio_show_io_depths(GtkWidget *vbox, struct thread_stat *ts)
-{
- GtkWidget *frame, *box, *tree_view;
- GtkTreeSelection *selection;
- GtkListStore *model;
- GType types[FIO_IO_U_MAP_NR + 1];
- int i;
-#define NR_LABELS 10
- const char *labels[NR_LABELS] = { "Depth", "0", "1", "2", "4", "8", "16", "32", "64", ">= 64" };
-
- frame = gtk_frame_new("IO depths");
- gtk_box_pack_start(GTK_BOX(vbox), frame, FALSE, FALSE, 5);
-
- box = gtk_hbox_new(FALSE, 3);
- gtk_container_add(GTK_CONTAINER(frame), box);
-
- for (i = 0; i < NR_LABELS; i++)
- types[i] = G_TYPE_STRING;
-
- model = gtk_list_store_newv(NR_LABELS, types);
-
- tree_view = gtk_tree_view_new_with_model(GTK_TREE_MODEL(model));
- gtk_widget_set_can_focus(tree_view, FALSE);
-