Ignore:
File:
1 edited

Legend:

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

    r196c253 rc0699467  
    8383 *
    8484 * @param item Sysinfo item (unused).
    85  * @param data Unused.
    8685 *
    8786 * @return System uptime (in secords).
    8887 *
    8988 */
    90 static sysarg_t get_stats_uptime(struct sysinfo_item *item, void *data)
     89static sysarg_t get_stats_uptime(struct sysinfo_item *item)
    9190{
    9291        /* This doesn't have to be very accurate */
     
    9998 * @param size    Size of the returned data.
    10099 * @param dry_run Do not get the data, just calculate the size.
    101  * @param data    Unused.
    102100 *
    103101 * @return Data containing several stats_cpu_t structures.
     
    106104 */
    107105static void *get_stats_cpus(struct sysinfo_item *item, size_t *size,
    108     bool dry_run, void *data)
     106    bool dry_run)
    109107{
    110108        *size = sizeof(stats_cpu_t) * config.cpu_count;
     
    251249        ASSERT(interrupts_disabled());
    252250        ASSERT(irq_spinlock_locked(&task->lock));
    253        
     251
    254252        stats_task->task_id = task->taskid;
    255253        str_cpy(stats_task->name, TASK_NAME_BUFLEN, task->name);
     
    295293 * @param size    Size of the returned data.
    296294 * @param dry_run Do not get the data, just calculate the size.
    297  * @param data    Unused.
    298295 *
    299296 * @return Data containing several stats_task_t structures.
     
    302299 */
    303300static void *get_stats_tasks(struct sysinfo_item *item, size_t *size,
    304     bool dry_run, void *data)
     301    bool dry_run)
    305302{
    306303        /* Messing with task structures, avoid deadlock */
     
    353350        ASSERT(interrupts_disabled());
    354351        ASSERT(irq_spinlock_locked(&thread->lock));
    355        
     352
    356353        stats_thread->thread_id = thread->tid;
    357354        stats_thread->task_id = thread->task->taskid;
     
    401398 * @param size    Size of the returned data.
    402399 * @param dry_run Do not get the data, just calculate the size.
    403  * @param data    Unused.
    404400 *
    405401 * @return Data containing several stats_task_t structures.
     
    408404 */
    409405static void *get_stats_threads(struct sysinfo_item *item, size_t *size,
    410     bool dry_run, void *data)
     406    bool dry_run)
    411407{
    412408        /* Messing with threads structures, avoid deadlock */
     
    455451 * @param name    Task ID (string-encoded number).
    456452 * @param dry_run Do not get the data, just calculate the size.
    457  * @param data    Unused.
    458453 *
    459454 * @return Sysinfo return holder. The type of the returned
     
    465460 *
    466461 */
    467 static sysinfo_return_t get_stats_task(const char *name, bool dry_run,
    468     void *data)
     462static sysinfo_return_t get_stats_task(const char *name, bool dry_run)
    469463{
    470464        /* Initially no return value */
     
    526520 * @param name    Thread ID (string-encoded number).
    527521 * @param dry_run Do not get the data, just calculate the size.
    528  * @param data    Unused.
    529522 *
    530523 * @return Sysinfo return holder. The type of the returned
     
    536529 *
    537530 */
    538 static sysinfo_return_t get_stats_thread(const char *name, bool dry_run,
    539     void *data)
     531static sysinfo_return_t get_stats_thread(const char *name, bool dry_run)
    540532{
    541533        /* Initially no return value */
     
    594586 * @param size    Size of the returned data.
    595587 * @param dry_run Do not get the data, just calculate the size.
    596  * @param data    Unused.
    597588 *
    598589 * @return Data containing several stats_exc_t structures.
     
    601592 */
    602593static void *get_stats_exceptions(struct sysinfo_item *item, size_t *size,
    603     bool dry_run, void *data)
     594    bool dry_run)
    604595{
    605596        *size = sizeof(stats_exc_t) * IVT_ITEMS;
     
    643634 * @param name    Exception number (string-encoded number).
    644635 * @param dry_run Do not get the data, just calculate the size.
    645  * @param data    Unused.
    646636 *
    647637 * @return Sysinfo return holder. The type of the returned
     
    653643 *
    654644 */
    655 static sysinfo_return_t get_stats_exception(const char *name, bool dry_run,
    656     void *data)
     645static sysinfo_return_t get_stats_exception(const char *name, bool dry_run)
    657646{
    658647        /* Initially no return value */
     
    716705 * @param size    Size of the returned data.
    717706 * @param dry_run Do not get the data, just calculate the size.
    718  * @param data    Unused.
    719707 *
    720708 * @return Data containing stats_physmem_t.
     
    723711 */
    724712static void *get_stats_physmem(struct sysinfo_item *item, size_t *size,
    725     bool dry_run, void *data)
     713    bool dry_run)
    726714{
    727715        *size = sizeof(stats_physmem_t);
     
    747735 * @param size    Size of the returned data.
    748736 * @param dry_run Do not get the data, just calculate the size.
    749  * @param data    Unused.
    750737 *
    751738 * @return Data several load_t values.
     
    754741 */
    755742static void *get_stats_load(struct sysinfo_item *item, size_t *size,
    756     bool dry_run, void *data)
     743    bool dry_run)
    757744{
    758745        *size = sizeof(load_t) * LOAD_STEPS;
     
    823810        mutex_initialize(&load_lock, MUTEX_PASSIVE);
    824811       
    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);
    835822}
    836823
Note: See TracChangeset for help on using the changeset viewer.