Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: main.c

Issue 6893111: Enhancements to ktop (Closed) Base URL: ssh://gitrw.chromium.org:9222/ktop.git@master
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ktop.h ('k') | mylib.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: main.c
diff --git a/main.c b/main.c
index 74929408a89ebbb7018d7bf0c6887268d0812f17..6038fd662610fc9f743e4f3506b70d2aec21d41b 100644
--- a/main.c
+++ b/main.c
@@ -12,17 +12,20 @@
#include <string.h>
#include <unistd.h>
+#include <debug.h>
#include <eprintf.h>
#include <style.h>
#include "ktop.h"
-int Command;
+bool Halt = FALSE;
bool Dump = FALSE;
-bool Trace_exit = FALSE;
+bool Trace_exit = TRUE;
bool Trace_self = FALSE;
+display_fn Display = kernel_display;
+
pid_t gettid(void) { return syscall(__NR_gettid); }
u8 Ignore_pid[(MAX_PID + 4) / 8];
@@ -49,6 +52,10 @@ bool do_ignore_pid(int pid)
void cleanup(int sig)
{
+PRd(sig);
+ if (sig) {
+ fprintf(stderr, "died because %d\n", sig);
+ }
cleanup_collector();
cleanup_display();
exit(0);
@@ -109,12 +116,12 @@ static void init(int argc, char *argv[])
void quit(void)
{
- Command = 1;
+ Halt = TRUE;
}
void clear(void)
{
- clear_display();
+ reset_reduce();
}
void commander(void)
@@ -129,6 +136,21 @@ void commander(void)
case 'c':
clear();
break;
+ case '<':
+ decrease_reduce_interval();
+ break;
+ case '>':
+ increase_reduce_interval();
+ break;
+ case 'i':
+ Display = internal_display;
+ break;
+ case 'k':
+ Display = kernel_display;
+ break;
+ case 'f':
+ Display = file_system_display;
+ break;
default:
break; // ignore
}
@@ -137,9 +159,11 @@ void commander(void)
int main(int argc, char **argv)
{
- pthread_t display_thread;
+ pthread_t reduce_thread;
int rc;
+ debugstderr();
+
init(argc, argv);
ignore_pid(gettid());
@@ -147,7 +171,7 @@ int main(int argc, char **argv)
start_collector();
if (!Dump) {
- rc = pthread_create(&display_thread, NULL, display, NULL);
+ rc = pthread_create(&reduce_thread, NULL, reduce, NULL);
}
commander();
« no previous file with comments | « ktop.h ('k') | mylib.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698