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