Changeset 196c253 in mainline for kernel/generic/src/sysinfo/stats.c


Ignore:
Timestamp:
2012-03-02T15:53:49Z (13 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
3113d47
Parents:
efb8d15
Message:

add support for private/instance data also for the other sysinfo generated content

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/sysinfo/stats.c

    refb8d15 r196c253  
    8383 *
    8484 * @param item Sysinfo item (unused).
     85 * @param data Unused.
    8586 *
    8687 * @return System uptime (in secords).
    8788 *
    8889 */
    89 static sysarg_t get_stats_uptime(struct sysinfo_item *item)
     90static sysarg_t get_stats_uptime(struct sysinfo_item *item, void *data)
    9091{
    9192        /* This doesn't have to be very accurate */
     
    9899 * @param size    Size of the returned data.
    99100 * @param dry_run Do not get the data, just calculate the size.
     101 * @param data    Unused.
    100102 *
    101103 * @return Data containing several stats_cpu_t structures.
     
    104106 */
    105107static void *get_stats_cpus(struct sysinfo_item *item, size_t *size,
    106     bool dry_run)
     108    bool dry_run, void *data)
    107109{
    108110        *size = sizeof(stats_cpu_t) * config.cpu_count;
     
    293295 * @param size    Size of the returned data.
    294296 * @param dry_run Do not get the data, just calculate the size.
     297 * @param data    Unused.
    295298 *
    296299 * @return Data containing several stats_task_t structures.
     
    299302 */
    300303static void *get_stats_tasks(struct sysinfo_item *item, size_t *size,
    301     bool dry_run)
     304    bool dry_run, void *data)
    302305{
    303306        /* Messing with task structures, avoid deadlock */
     
    398401 * @param size    Size of the returned data.
    399402 * @param dry_run Do not get the data, just calculate the size.
     403 * @param data    Unused.
    400404 *
    401405 * @return Data containing several stats_task_t structures.
     
    404408 */
    405409static void *get_stats_threads(struct sysinfo_item *item, size_t *size,
    406     bool dry_run)
     410    bool dry_run, void *data)
    407411{
    408412        /* Messing with threads structures, avoid deadlock */
     
    590594 * @param size    Size of the returned data.
    591595 * @param dry_run Do not get the data, just calculate the size.
     596 * @param data    Unused.
    592597 *
    593598 * @return Data containing several stats_exc_t structures.
     
    596601 */
    597602static void *get_stats_exceptions(struct sysinfo_item *item, size_t *size,
    598     bool dry_run)
     603    bool dry_run, void *data)
    599604{
    600605        *size = sizeof(stats_exc_t) * IVT_ITEMS;
     
    711716 * @param size    Size of the returned data.
    712717 * @param dry_run Do not get the data, just calculate the size.
     718 * @param data    Unused.
    713719 *
    714720 * @return Data containing stats_physmem_t.
     
    717723 */
    718724static void *get_stats_physmem(struct sysinfo_item *item, size_t *size,
    719     bool dry_run)
     725    bool dry_run, void *data)
    720726{
    721727        *size = sizeof(stats_physmem_t);
     
    741747 * @param size    Size of the returned data.
    742748 * @param dry_run Do not get the data, just calculate the size.
     749 * @param data    Unused.
    743750 *
    744751 * @return Data several load_t values.
     
    747754 */
    748755static void *get_stats_load(struct sysinfo_item *item, size_t *size,
    749     bool dry_run)
     756    bool dry_run, void *data)
    750757{
    751758        *size = sizeof(load_t) * LOAD_STEPS;
     
    816823        mutex_initialize(&load_lock, MUTEX_PASSIVE);
    817824       
    818         sysinfo_set_item_fn_val("system.uptime", NULL, get_stats_uptime);
    819         sysinfo_set_item_fn_data("system.cpus", NULL, get_stats_cpus);
    820         sysinfo_set_item_fn_data("system.physmem", NULL, get_stats_physmem);
    821         sysinfo_set_item_fn_data("system.load", NULL, get_stats_load);
    822         sysinfo_set_item_fn_data("system.tasks", NULL, get_stats_tasks);
    823         sysinfo_set_item_fn_data("system.threads", NULL, get_stats_threads);
    824         sysinfo_set_item_fn_data("system.exceptions", NULL, get_stats_exceptions);
     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);
    825832        sysinfo_set_subtree_fn("system.tasks", NULL, get_stats_task, NULL);
    826833        sysinfo_set_subtree_fn("system.threads", NULL, get_stats_thread, NULL);
Note: See TracChangeset for help on using the changeset viewer.