- Timestamp:
- 2010-06-10T14:24:50Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c0f13d2
- Parents:
- 1113c9e
- Location:
- uspace
- Files:
-
- 5 edited
-
app/top/screen.c (modified) (2 diffs)
-
app/top/top.c (modified) (3 diffs)
-
app/top/top.h (modified) (2 diffs)
-
lib/c/generic/stats.c (modified) (1 diff)
-
lib/c/include/stats.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/top/screen.c
r1113c9e r8eec3c8 325 325 } 326 326 327 static inline void print_exc_head(void) 328 { 329 screen_style_inverted(); 330 printf(" ID Desc Count Cycles"); 331 screen_newline(); 332 screen_style_normal(); 333 } 334 335 static inline void print_exc(data_t *data) 336 { 337 ipcarg_t cols; 338 ipcarg_t rows; 339 screen_get_size(&cols, &rows); 340 341 ipcarg_t col; 342 ipcarg_t row; 343 screen_get_pos(&col, &row); 344 345 size_t i; 346 for (i = 0; (i < data->exceptions_count) && (row < rows); i++, row++) { 347 uint64_t cycles; 348 char suffix; 349 350 order_suffix(data->exceptions[i].cycles, &cycles, &suffix); 351 printf("%8u %20s %8" PRIu64 " %8" PRIu64 "%c", 352 data->exceptions[i].id, data->exceptions[i].desc, 353 data->exceptions[i].count, cycles, suffix); 354 355 screen_newline(); 356 } 357 358 while (row < rows) { 359 screen_newline(); 360 row++; 361 } 362 } 363 327 364 void print_data(data_t *data) 328 365 { … … 338 375 screen_newline(); 339 376 340 if (operation_type == OP_IPC) { 377 switch (operation_type) { 378 case OP_TASKS: 379 print_task_head(); 380 print_tasks(data); 381 break; 382 case OP_IPC: 341 383 print_ipc_head(); 342 384 print_ipc(data); 343 } else { 344 print_task_head(); 345 print_tasks(data); 385 break; 386 case OP_EXC: 387 print_exc_head(); 388 print_exc(data); 389 break; 346 390 } 347 391 -
uspace/app/top/top.c
r1113c9e r8eec3c8 115 115 return "Cannot get threads"; 116 116 117 target->exceptions = stats_get_exceptions(&(target->exceptions_count)); 118 if (target->exceptions == NULL) 119 return "Cannot get exceptions"; 120 117 121 /* Get physical memory */ 118 122 target->physmem = stats_get_physmem(); … … 231 235 if (target->threads != NULL) 232 236 free(target->threads); 237 238 if (target->exceptions != NULL) 239 free(target->exceptions); 233 240 234 241 if (target->physmem != NULL) … … 285 292 operation_type = OP_TASKS; 286 293 break; 294 case 'e': 295 print_warning("Showing exception statistics"); 296 operation_type = OP_EXC; 297 break; 287 298 default: 288 299 print_warning("Unknown command: %c", c); -
uspace/app/top/top.h
r1113c9e r8eec3c8 46 46 #define OP_TASKS 1 47 47 #define OP_IPC 2 48 #define OP_EXC 3 48 49 49 50 extern int operation_type; … … 89 90 stats_thread_t *threads; 90 91 92 size_t exceptions_count; 93 stats_exc_t *exceptions; 94 91 95 stats_physmem_t *physmem; 92 96 } data_t; -
uspace/lib/c/generic/stats.c
r1113c9e r8eec3c8 184 184 } 185 185 186 /** Get exception statistics. 187 * 188 * @param count Number of records returned. 189 * 190 * @return Array of stats_exc_t structures. 191 * If non-NULL then it should be eventually freed 192 * by free(). 193 * 194 */ 195 stats_exc_t *stats_get_exceptions(size_t *count) 196 { 197 size_t size = 0; 198 stats_exc_t *stats_exceptions = 199 (stats_exc_t *) sysinfo_get_data("system.exceptions", &size); 200 201 assert((size % sizeof(stats_exc_t)) == 0); 202 203 *count = size / sizeof(stats_exc_t); 204 return stats_exceptions; 205 } 206 207 /** Get single exception statistics 208 * 209 * @param excn Exception number we are interested in. 210 * 211 * @return Pointer to the stats_exc_t structure. 212 * If non-NULL then it should be eventually freed 213 * by free(). 214 * 215 */ 216 stats_exc_t *stats_get_exception(unsigned int excn) 217 { 218 char name[SYSINFO_STATS_MAX_PATH]; 219 snprintf(name, SYSINFO_STATS_MAX_PATH, "system.exceptionss.%u", excn); 220 221 size_t size = 0; 222 stats_exc_t *stats_exception = 223 (stats_exc_t *) sysinfo_get_data(name, &size); 224 225 assert((size == sizeof(stats_exc_t)) || (size == 0)); 226 227 return stats_exception; 228 } 229 186 230 /** Get system load 187 231 * -
uspace/lib/c/include/stats.h
r1113c9e r8eec3c8 53 53 extern stats_thread_t *stats_get_thread(thread_id_t); 54 54 55 extern stats_exc_t *stats_get_exceptions(size_t *); 56 extern stats_exc_t *stats_get_exception(unsigned int); 57 55 58 extern void stats_print_load_fragment(load_t, unsigned int); 56 59 extern const char *thread_get_state(state_t);
Note:
See TracChangeset
for help on using the changeset viewer.
