Changeset 5869ce0 in mainline
- Timestamp:
- 2012-03-01T23:22:32Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0030eef
- Parents:
- 3d23553
- Location:
- kernel/generic
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/include/sysinfo/sysinfo.h
r3d23553 r5869ce0 73 73 typedef union { 74 74 sysarg_t val; /**< Constant numberic value */ 75 sysinfo_data_t data; /**< Constant binary data */ 75 76 sysinfo_fn_val_t fn_val; /**< Generated numeric value function */ 76 77 sysinfo_fn_data_t fn_data; /**< Generated binary data function */ 77 sysinfo_data_t data; /**< Constant binary data */78 78 } sysinfo_item_val_t; 79 79 … … 95 95 96 96 /** Generated subtree function */ 97 typedef sysinfo_return_t (*sysinfo_fn_subtree_t)(const char *, bool); 97 typedef sysinfo_return_t (*sysinfo_fn_subtree_t)(const char *, bool, void *); 98 99 /** Sysinfo generated subtree data 100 * 101 */ 102 typedef struct { 103 sysinfo_fn_subtree_t fn; /**< Generated subtree function */ 104 void *data; /**< Private data */ 105 } sysinfo_fn_subtree_data_t; 98 106 99 107 /** Sysinfo subtree (union) … … 101 109 */ 102 110 typedef union { 103 struct sysinfo_item *table; /**< Fixed subtree (list of subitems) */104 sysinfo_fn_subtree_ t get_data; /**< Generated subtree function*/111 struct sysinfo_item *table; /**< Fixed subtree (list of subitems) */ 112 sysinfo_fn_subtree_data_t generator; /**< Generated subtree */ 105 113 } sysinfo_subtree_t; 106 114 … … 130 138 131 139 extern void sysinfo_set_subtree_fn(const char *, sysinfo_item_t **, 132 sysinfo_fn_subtree_t );140 sysinfo_fn_subtree_t, void *); 133 141 134 142 extern void sysinfo_init(void); -
kernel/generic/src/sysinfo/stats.c
r3d23553 r5869ce0 451 451 * @param name Task ID (string-encoded number). 452 452 * @param dry_run Do not get the data, just calculate the size. 453 * @param data Unused. 453 454 * 454 455 * @return Sysinfo return holder. The type of the returned … … 460 461 * 461 462 */ 462 static sysinfo_return_t get_stats_task(const char *name, bool dry_run) 463 static sysinfo_return_t get_stats_task(const char *name, bool dry_run, 464 void *data) 463 465 { 464 466 /* Initially no return value */ … … 520 522 * @param name Thread ID (string-encoded number). 521 523 * @param dry_run Do not get the data, just calculate the size. 524 * @param data Unused. 522 525 * 523 526 * @return Sysinfo return holder. The type of the returned … … 529 532 * 530 533 */ 531 static sysinfo_return_t get_stats_thread(const char *name, bool dry_run) 534 static sysinfo_return_t get_stats_thread(const char *name, bool dry_run, 535 void *data) 532 536 { 533 537 /* Initially no return value */ … … 634 638 * @param name Exception number (string-encoded number). 635 639 * @param dry_run Do not get the data, just calculate the size. 640 * @param data Unused. 636 641 * 637 642 * @return Sysinfo return holder. The type of the returned … … 643 648 * 644 649 */ 645 static sysinfo_return_t get_stats_exception(const char *name, bool dry_run) 650 static sysinfo_return_t get_stats_exception(const char *name, bool dry_run, 651 void *data) 646 652 { 647 653 /* Initially no return value */ … … 817 823 sysinfo_set_item_fn_data("system.threads", NULL, get_stats_threads); 818 824 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_subtree_fn("system.tasks", NULL, get_stats_task, NULL); 826 sysinfo_set_subtree_fn("system.threads", NULL, get_stats_thread, NULL); 827 sysinfo_set_subtree_fn("system.exceptions", NULL, get_stats_exception, NULL); 822 828 } 823 829 -
kernel/generic/src/sysinfo/sysinfo.c
r3d23553 r5869ce0 151 151 case SYSINFO_SUBTREE_FUNCTION: 152 152 /* Get generated data */ 153 **ret = cur->subtree.get_data(name + i + 1, dry_run); 153 **ret = cur->subtree.generator.fn(name + i + 1, dry_run, 154 cur->subtree.generator.data); 154 155 return NULL; 155 156 default: … … 431 432 * a new root item (NULL for global sysinfo root). 432 433 * @param fn Subtree generator function. 434 * @param data Private data to be passed to the generator. 433 435 * 434 436 */ 435 437 void sysinfo_set_subtree_fn(const char *name, sysinfo_item_t **root, 436 sysinfo_fn_subtree_t fn )438 sysinfo_fn_subtree_t fn, void *data) 437 439 { 438 440 /* Protect sysinfo tree consistency */ … … 448 450 if ((item != NULL) && (item->subtree_type != SYSINFO_SUBTREE_TABLE)) { 449 451 item->subtree_type = SYSINFO_SUBTREE_FUNCTION; 450 item->subtree.get_data = fn; 452 item->subtree.generator.fn = fn; 453 item->subtree.generator.data = data; 451 454 } 452 455
Note:
See TracChangeset
for help on using the changeset viewer.