Changeset 8f56d93 in mainline for uspace/app/top/screen.c
- Timestamp:
- 2010-04-02T13:35:19Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8b2aba5
- Parents:
- 175ad5c6
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/top/screen.c
r175ad5c6 r8f56d93 39 39 #include <vfs/vfs.h> 40 40 #include <load.h> 41 #include <kernel/ps/taskinfo.h> 42 #include <ps.h> 41 43 #include "screen.h" 42 44 #include "top.h" 45 46 int rows; 47 int colls; 48 49 #define WHITE 0xf0f0f0 50 #define BLACK 0x000000 43 51 44 52 static void resume_normal(void) 45 53 { 46 54 fflush(stdout); 47 console_set_rgb_color(fphone(stdout), 0, 0xf0f0f0);55 console_set_rgb_color(fphone(stdout), 0, WHITE); 48 56 } 49 57 50 58 void screen_init(void) 51 59 { 60 console_get_size(fphone(stdout), &colls, &rows); 52 61 console_cursor_visibility(fphone(stdout), 0); 53 62 resume_normal(); … … 94 103 } 95 104 105 static inline void print_tasks(data_t *data, int row) 106 { 107 int i; 108 for (i = 0; i < (int)data->task_count; ++i) { 109 if (row + i > rows) 110 return; 111 task_info_t taskinfo; 112 get_task_info(data->tasks[i], &taskinfo); 113 printf("%8llu %8u %8u %12llu %12llu %s\n", taskinfo.taskid, 114 taskinfo.thread_count, taskinfo.pages, taskinfo.ucycles / 1000 / 1000, 115 taskinfo.kcycles / 1000 / 1000, taskinfo.name); 116 } 117 } 118 119 120 static inline void print_head(void) 121 { 122 fflush(stdout); 123 console_set_rgb_color(fphone(stdout), WHITE, BLACK); 124 printf(" ID Threads Pages uCycles kCycles Name"); 125 int i; 126 for (i = 60; i < colls; ++i) 127 puts(" "); 128 fflush(stdout); 129 console_set_rgb_color(fphone(stdout), BLACK, WHITE); 130 } 131 96 132 void print_data(data_t *data) 97 133 { … … 104 140 puts("\n"); 105 141 print_taskstat(data); 142 puts("\n\n"); 143 print_head(); 106 144 puts("\n"); 145 print_tasks(data, 4); 107 146 fflush(stdout); 108 147 }
Note:
See TracChangeset
for help on using the changeset viewer.