Changes in uspace/app/top/screen.c [933cadf:172aad6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/top/screen.c
r933cadf r172aad6 37 37 38 38 #include <stdio.h> 39 #include <ipc/ipc.h> 39 40 #include <io/console.h> 40 41 #include <io/style.h> … … 46 47 #include "top.h" 47 48 48 static sysarg_t warn_col = 0;49 static sysarg_t warn_row = 0;49 static ipcarg_t warn_col = 0; 50 static ipcarg_t warn_row = 0; 50 51 51 52 static void screen_style_normal(void) … … 61 62 } 62 63 63 static void screen_moveto( sysarg_t col, sysarg_t row)64 static void screen_moveto(ipcarg_t col, ipcarg_t row) 64 65 { 65 66 fflush(stdout); … … 67 68 } 68 69 69 static void screen_get_pos( sysarg_t *col, sysarg_t *row)70 static void screen_get_pos(ipcarg_t *col, ipcarg_t *row) 70 71 { 71 72 fflush(stdout); … … 73 74 } 74 75 75 static void screen_get_size( sysarg_t *col, sysarg_t *row)76 static void screen_get_size(ipcarg_t *col, ipcarg_t *row) 76 77 { 77 78 fflush(stdout); … … 93 94 static void screen_newline(void) 94 95 { 95 sysarg_t cols;96 sysarg_t rows;96 ipcarg_t cols; 97 ipcarg_t rows; 97 98 screen_get_size(&cols, &rows); 98 99 99 sysarg_t c;100 sysarg_t r;100 ipcarg_t c; 101 ipcarg_t r; 101 102 screen_get_pos(&c, &r); 102 103 103 sysarg_t i;104 ipcarg_t i; 104 105 for (i = c + 1; i < cols; i++) 105 106 puts(" "); … … 141 142 static void print_string(const char *str) 142 143 { 143 sysarg_t cols;144 sysarg_t rows;144 ipcarg_t cols; 145 ipcarg_t rows; 145 146 screen_get_size(&cols, &rows); 146 147 147 sysarg_t c;148 sysarg_t r;148 ipcarg_t c; 149 ipcarg_t r; 149 150 screen_get_pos(&c, &r); 150 151 151 if (c < cols) { 152 int pos = cols - c - 1; 153 printf("%.*s", pos, str); 154 } 152 if (c < cols) 153 printf("%.*s", cols - c - 1, str); 155 154 } 156 155 157 156 static inline void print_global_head(data_t *data) 158 157 { 159 printf("top - %02lu:%02lu:%02lu up " 160 "%" PRIun " days, %02" PRIun ":%02" PRIun ":%02" PRIun ", " 161 "load average:", 158 printf("top - %02lu:%02lu:%02lu up %u days, %02u:%02u:%02u, load average:", 162 159 data->hours, data->minutes, data->seconds, 163 160 data->udays, data->uhours, data->uminutes, data->useconds); … … 174 171 static inline void print_task_summary(data_t *data) 175 172 { 176 printf("tasks: % zu total", data->tasks_count);173 printf("tasks: %u total", data->tasks_count); 177 174 screen_newline(); 178 175 } … … 214 211 } 215 212 216 printf("threads: % zu total, %zu running, %zu ready, "217 "% zu sleeping, %zu lingering, %zu other, %zu invalid",213 printf("threads: %u total, %u running, %u ready, %u sleeping, %u lingering, " 214 "%u other, %u invalid", 218 215 total, running, ready, sleeping, lingering, other, invalid); 219 216 screen_newline(); … … 254 251 uint64_t used; 255 252 uint64_t free; 256 c onst char *total_suffix;257 c onst char *unavail_suffix;258 c onst char *used_suffix;259 c onst char *free_suffix;260 261 bin_order_suffix(data->physmem->total, &total, &total_suffix, false);262 bin_order_suffix(data->physmem->unavail, &unavail, &unavail_suffix, false);263 bin_order_suffix(data->physmem->used, &used, &used_suffix, false);264 bin_order_suffix(data->physmem->free, &free, &free_suffix, false);265 266 printf("memory: %" PRIu64 "% s total, %" PRIu64 "%sunavail, %"267 PRIu64 "% s used, %" PRIu64 "%sfree", total, total_suffix,253 char total_suffix; 254 char unavail_suffix; 255 char used_suffix; 256 char free_suffix; 257 258 order_suffix(data->physmem->total, &total, &total_suffix); 259 order_suffix(data->physmem->unavail, &unavail, &unavail_suffix); 260 order_suffix(data->physmem->used, &used, &used_suffix); 261 order_suffix(data->physmem->free, &free, &free_suffix); 262 263 printf("memory: %" PRIu64 "%c total, %" PRIu64 "%c unavail, %" 264 PRIu64 "%c used, %" PRIu64 "%c free", total, total_suffix, 268 265 unavail, unavail_suffix, used, used_suffix, free, free_suffix); 269 266 screen_newline(); … … 273 270 { 274 271 screen_style_inverted(); 275 printf("[taskid] [thr ds] [resident] [%%resi] [virtual] [%%virt]"276 " [%% user] [%%kern] [name");272 printf("[taskid] [threads] [virtual] [%%virt] [%%user]" 273 " [%%kernel] [name"); 277 274 screen_newline(); 278 275 screen_style_normal(); … … 281 278 static inline void print_tasks(data_t *data) 282 279 { 283 sysarg_t cols;284 sysarg_t rows;280 ipcarg_t cols; 281 ipcarg_t rows; 285 282 screen_get_size(&cols, &rows); 286 283 287 sysarg_t col;288 sysarg_t row;284 ipcarg_t col; 285 ipcarg_t row; 289 286 screen_get_pos(&col, &row); 290 287 … … 294 291 perc_task_t *perc = data->tasks_perc + data->tasks_map[i]; 295 292 296 uint64_t resmem;297 const char *resmem_suffix;298 bin_order_suffix(task->resmem, &resmem, &resmem_suffix, true);299 300 293 uint64_t virtmem; 301 const char *virtmem_suffix; 302 bin_order_suffix(task->virtmem, &virtmem, &virtmem_suffix, true); 303 304 printf("%-8" PRIu64 " %7zu %7" PRIu64 "%s ", 305 task->task_id, task->threads, resmem, resmem_suffix); 306 print_percent(perc->resmem, 2); 307 printf(" %6" PRIu64 "%s ", virtmem, virtmem_suffix); 294 char virtmem_suffix; 295 order_suffix(task->virtmem, &virtmem, &virtmem_suffix); 296 297 printf("%-8" PRIu64 " %9u %8" PRIu64 "%c ", task->task_id, 298 task->threads, virtmem, virtmem_suffix); 308 299 print_percent(perc->virtmem, 2); 309 300 puts(" "); 310 301 print_percent(perc->ucycles, 2); 311 puts(" ");302 puts(" "); 312 303 print_percent(perc->kcycles, 2); 313 304 puts(" "); … … 334 325 static inline void print_ipc(data_t *data) 335 326 { 336 sysarg_t cols;337 sysarg_t rows;327 ipcarg_t cols; 328 ipcarg_t rows; 338 329 screen_get_size(&cols, &rows); 339 330 340 sysarg_t col;341 sysarg_t row;331 ipcarg_t col; 332 ipcarg_t row; 342 333 screen_get_pos(&col, &row); 343 334 … … 401 392 static inline void print_excs(data_t *data) 402 393 { 403 sysarg_t cols;404 sysarg_t rows;394 ipcarg_t cols; 395 ipcarg_t rows; 405 396 screen_get_size(&cols, &rows); 406 397 407 sysarg_t col;408 sysarg_t row;398 ipcarg_t col; 399 ipcarg_t row; 409 400 screen_get_pos(&col, &row); 410 401 … … 444 435 static void print_help(void) 445 436 { 446 sysarg_t cols;447 sysarg_t rows;437 ipcarg_t cols; 438 ipcarg_t rows; 448 439 screen_get_size(&cols, &rows); 449 440 450 sysarg_t col;451 sysarg_t row;441 ipcarg_t col; 442 ipcarg_t row; 452 443 screen_get_pos(&col, &row); 453 444
Note:
See TracChangeset
for help on using the changeset viewer.