newproc->threads = g_ptr_array_new();
newproc->perf = g_hash_table_new(g_str_hash, g_str_equal);
g_ptr_array_add(ctx->process_table, newproc);
+
+ ctx->nbnewthreads++;
+ ctx->nbthreads++;
}
newproc->comm = strdup(comm);
{
struct processtop *tmp;
tmp = find_process_tid(ctx, tid, comm);
- if (tmp && strcmp(tmp->comm, comm) == 0)
+ if (tmp && strcmp(tmp->comm, comm) == 0) {
tmp->death = timestamp;
+ ctx->nbdeadthreads++;
+ ctx->nbthreads--;
+ }
}
struct processtop* get_proc(struct lttngtop *ctx, int tid, char *comm,
}
}
+void reset_global_counters()
+{
+ lttngtop.nbnewproc = 0;
+ lttngtop.nbdeadproc = 0;
+ lttngtop.nbnewthreads = 0;
+ lttngtop.nbdeadthreads = 0;
+ lttngtop.nbnewfiles = 0;
+ lttngtop.nbclosedfiles = 0;
+}
+
+void copy_global_counters(struct lttngtop *dst)
+{
+ dst->nbproc = lttngtop.nbproc;
+ dst->nbnewproc = lttngtop.nbnewproc;
+ dst->nbdeadproc = lttngtop.nbdeadproc;
+ dst->nbthreads = lttngtop.nbthreads;
+ dst->nbnewthreads = lttngtop.nbnewthreads;
+ dst->nbdeadthreads = lttngtop.nbdeadthreads;
+ dst->nbfiles = lttngtop.nbfiles;
+ dst->nbnewfiles = lttngtop.nbnewfiles;
+ dst->nbclosedfiles = lttngtop.nbclosedfiles;
+ reset_global_counters();
+}
+
struct lttngtop* get_copy_lttngtop(unsigned long start, unsigned long end)
{
gint i, j;
dst = g_new0(struct lttngtop, 1);
dst->start = start;
dst->end = end;
+ copy_global_counters(dst);
dst->process_table = g_ptr_array_new();
dst->files_table = g_ptr_array_new();
dst->cpu_table = g_ptr_array_new();
* files associated with if after the copy
*/
if (tmp->death > 0 && tmp->death < end) {
+ /* FIXME : close the files before */
g_ptr_array_remove(tmp->process_files_table, tmpfile);
g_free(tmpfile);
}
* the current process list after the copy
*/
if (tmp->death > 0 && tmp->death < end) {
+ fprintf(stderr, "removing : %ld : %d %s\n", end, tmp->tid, tmp->comm);
g_ptr_array_remove(lttngtop.process_table, tmp);
/* FIXME : TRUE does not mean clears the object in it */
g_ptr_array_free(tmp->threads, TRUE);
wattron(header, A_BOLD);
mvwprintw(header, line, 4, "%s", desc);
wattroff(header, A_BOLD);
- mvwprintw(header, line, 16, "N/A", value);
+ mvwprintw(header, line, 16, "%d", value);
wmove(header, line, 24);
print_digits(header, first, second);
wmove(header, line, 40);
set_window_title(header, "Statistics for interval [gathering data...[");
wattron(header, A_BOLD);
mvwprintw(header, 1, 4, "CPUs");
- mvwprintw(header, 2, 4, "Processes");
- mvwprintw(header, 3, 4, "Threads");
- mvwprintw(header, 4, 4, "Files");
- mvwprintw(header, 5, 4, "Network");
- mvwprintw(header, 6, 4, "IO");
+ mvwprintw(header, 2, 4, "Threads");
+ mvwprintw(header, 3, 4, "Files");
+ mvwprintw(header, 4, 4, "Network");
wattroff(header, A_BOLD);
wrefresh(header);
}
wattroff(header, A_BOLD);
wprintw(header, "\t%d\t(max/cpu : %0.2f%)", data->cpu_table->len,
100.0/data->cpu_table->len);
- print_headers(2, "Processes", data->nbproc, data->nbnewproc,
- -1*(data->nbdeadproc));
- print_headers(3, "Threads", data->nbthreads, data->nbnewthreads,
+ print_headers(2, "Threads", data->nbthreads, data->nbnewthreads,
-1*(data->nbdeadthreads));
- print_headers(4, "Files", data->nbfiles, data->nbnewfiles,
+ print_headers(3, "Files", data->nbfiles, data->nbnewfiles,
-1*(data->nbclosedfiles));
- mvwprintw(header, 4, 43, "N/A kbytes/sec");
- print_headers(5, "Network", 114, 0, 0);
- mvwprintw(header, 5, 43, "N/A Mbytes/sec");
+ mvwprintw(header, 3, 43, "N/A kbytes/sec");
+ print_headers(4, "Network", 0, 0, 0);
+ mvwprintw(header, 4, 43, "N/A Mbytes/sec");
wrefresh(header);
}
sem_init(&update_display_sem, 0, 1);
init_screen();
- header = create_window(7, COLS - 1, 0, 0);
- center = create_window(LINES - 7 - 7, COLS - 1, 7, 0);
+ header = create_window(6, COLS - 1, 0, 0);
+ center = create_window(LINES - 7 - 7, COLS - 1, 6, 0);
status = create_window(MAX_LOG_LINES + 2, COLS - 1, LINES - 7, 0);
footer = create_window(1, COLS - 1, LINES - 1, 0);