Changes in kernel/generic/src/sysinfo/stats.c [c0699467:059a8e4] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/sysinfo/stats.c
rc0699467 r059a8e4 83 83 * 84 84 * @param item Sysinfo item (unused). 85 * @param data Unused. 85 86 * 86 87 * @return System uptime (in secords). 87 88 * 88 89 */ 89 static sysarg_t get_stats_uptime(struct sysinfo_item *item )90 static sysarg_t get_stats_uptime(struct sysinfo_item *item, void *data) 90 91 { 91 92 /* This doesn't have to be very accurate */ … … 98 99 * @param size Size of the returned data. 99 100 * @param dry_run Do not get the data, just calculate the size. 101 * @param data Unused. 100 102 * 101 103 * @return Data containing several stats_cpu_t structures. … … 104 106 */ 105 107 static void *get_stats_cpus(struct sysinfo_item *item, size_t *size, 106 bool dry_run )108 bool dry_run, void *data) 107 109 { 108 110 *size = sizeof(stats_cpu_t) * config.cpu_count; … … 249 251 ASSERT(interrupts_disabled()); 250 252 ASSERT(irq_spinlock_locked(&task->lock)); 251 253 252 254 stats_task->task_id = task->taskid; 253 255 str_cpy(stats_task->name, TASK_NAME_BUFLEN, task->name); … … 293 295 * @param size Size of the returned data. 294 296 * @param dry_run Do not get the data, just calculate the size. 297 * @param data Unused. 295 298 * 296 299 * @return Data containing several stats_task_t structures. … … 299 302 */ 300 303 static void *get_stats_tasks(struct sysinfo_item *item, size_t *size, 301 bool dry_run )304 bool dry_run, void *data) 302 305 { 303 306 /* Messing with task structures, avoid deadlock */ … … 350 353 ASSERT(interrupts_disabled()); 351 354 ASSERT(irq_spinlock_locked(&thread->lock)); 352 355 353 356 stats_thread->thread_id = thread->tid; 354 357 stats_thread->task_id = thread->task->taskid; … … 398 401 * @param size Size of the returned data. 399 402 * @param dry_run Do not get the data, just calculate the size. 403 * @param data Unused. 400 404 * 401 405 * @return Data containing several stats_task_t structures. … … 404 408 */ 405 409 static void *get_stats_threads(struct sysinfo_item *item, size_t *size, 406 bool dry_run )410 bool dry_run, void *data) 407 411 { 408 412 /* Messing with threads structures, avoid deadlock */ … … 451 455 * @param name Task ID (string-encoded number). 452 456 * @param dry_run Do not get the data, just calculate the size. 457 * @param data Unused. 453 458 * 454 459 * @return Sysinfo return holder. The type of the returned … … 460 465 * 461 466 */ 462 static sysinfo_return_t get_stats_task(const char *name, bool dry_run) 467 static sysinfo_return_t get_stats_task(const char *name, bool dry_run, 468 void *data) 463 469 { 464 470 /* Initially no return value */ … … 468 474 /* Parse the task ID */ 469 475 task_id_t task_id; 470 if (str_uint64 (name, NULL, 0, true, &task_id) != EOK)476 if (str_uint64_t(name, NULL, 0, true, &task_id) != EOK) 471 477 return ret; 472 478 … … 520 526 * @param name Thread ID (string-encoded number). 521 527 * @param dry_run Do not get the data, just calculate the size. 528 * @param data Unused. 522 529 * 523 530 * @return Sysinfo return holder. The type of the returned … … 529 536 * 530 537 */ 531 static sysinfo_return_t get_stats_thread(const char *name, bool dry_run) 538 static sysinfo_return_t get_stats_thread(const char *name, bool dry_run, 539 void *data) 532 540 { 533 541 /* Initially no return value */ … … 537 545 /* Parse the thread ID */ 538 546 thread_id_t thread_id; 539 if (str_uint64 (name, NULL, 0, true, &thread_id) != EOK)547 if (str_uint64_t(name, NULL, 0, true, &thread_id) != EOK) 540 548 return ret; 541 549 … … 586 594 * @param size Size of the returned data. 587 595 * @param dry_run Do not get the data, just calculate the size. 596 * @param data Unused. 588 597 * 589 598 * @return Data containing several stats_exc_t structures. … … 592 601 */ 593 602 static void *get_stats_exceptions(struct sysinfo_item *item, size_t *size, 594 bool dry_run )603 bool dry_run, void *data) 595 604 { 596 605 *size = sizeof(stats_exc_t) * IVT_ITEMS; … … 634 643 * @param name Exception number (string-encoded number). 635 644 * @param dry_run Do not get the data, just calculate the size. 645 * @param data Unused. 636 646 * 637 647 * @return Sysinfo return holder. The type of the returned … … 643 653 * 644 654 */ 645 static sysinfo_return_t get_stats_exception(const char *name, bool dry_run) 655 static sysinfo_return_t get_stats_exception(const char *name, bool dry_run, 656 void *data) 646 657 { 647 658 /* Initially no return value */ … … 651 662 /* Parse the exception number */ 652 663 uint64_t excn; 653 if (str_uint64 (name, NULL, 0, true, &excn) != EOK)664 if (str_uint64_t(name, NULL, 0, true, &excn) != EOK) 654 665 return ret; 655 666 … … 705 716 * @param size Size of the returned data. 706 717 * @param dry_run Do not get the data, just calculate the size. 718 * @param data Unused. 707 719 * 708 720 * @return Data containing stats_physmem_t. … … 711 723 */ 712 724 static void *get_stats_physmem(struct sysinfo_item *item, size_t *size, 713 bool dry_run )725 bool dry_run, void *data) 714 726 { 715 727 *size = sizeof(stats_physmem_t); … … 735 747 * @param size Size of the returned data. 736 748 * @param dry_run Do not get the data, just calculate the size. 749 * @param data Unused. 737 750 * 738 751 * @return Data several load_t values. … … 741 754 */ 742 755 static void *get_stats_load(struct sysinfo_item *item, size_t *size, 743 bool dry_run )756 bool dry_run, void *data) 744 757 { 745 758 *size = sizeof(load_t) * LOAD_STEPS; … … 810 823 mutex_initialize(&load_lock, MUTEX_PASSIVE); 811 824 812 sysinfo_set_item_ fn_val("system.uptime", NULL, get_stats_uptime);813 sysinfo_set_item_ fn_data("system.cpus", NULL, get_stats_cpus);814 sysinfo_set_item_ fn_data("system.physmem", NULL, get_stats_physmem);815 sysinfo_set_item_ fn_data("system.load", NULL, get_stats_load);816 sysinfo_set_item_ fn_data("system.tasks", NULL, get_stats_tasks);817 sysinfo_set_item_ fn_data("system.threads", NULL, get_stats_threads);818 sysinfo_set_item_ fn_data("system.exceptions", NULL, get_stats_exceptions);819 sysinfo_set_subtree_fn("system.tasks", NULL, get_stats_task );820 sysinfo_set_subtree_fn("system.threads", NULL, get_stats_thread );821 sysinfo_set_subtree_fn("system.exceptions", NULL, get_stats_exception );825 sysinfo_set_item_gen_val("system.uptime", NULL, get_stats_uptime, NULL); 826 sysinfo_set_item_gen_data("system.cpus", NULL, get_stats_cpus, NULL); 827 sysinfo_set_item_gen_data("system.physmem", NULL, get_stats_physmem, NULL); 828 sysinfo_set_item_gen_data("system.load", NULL, get_stats_load, NULL); 829 sysinfo_set_item_gen_data("system.tasks", NULL, get_stats_tasks, NULL); 830 sysinfo_set_item_gen_data("system.threads", NULL, get_stats_threads, NULL); 831 sysinfo_set_item_gen_data("system.exceptions", NULL, get_stats_exceptions, NULL); 832 sysinfo_set_subtree_fn("system.tasks", NULL, get_stats_task, NULL); 833 sysinfo_set_subtree_fn("system.threads", NULL, get_stats_thread, NULL); 834 sysinfo_set_subtree_fn("system.exceptions", NULL, get_stats_exception, NULL); 822 835 } 823 836
Note:
See TracChangeset
for help on using the changeset viewer.