[9dae191e] | 1 | /*
|
---|
| 2 | * Copyright (c) 2010 Stanislav Kozina
|
---|
| 3 | * Copyright (c) 2010 Martin Decky
|
---|
| 4 | * All rights reserved.
|
---|
| 5 | *
|
---|
| 6 | * Redistribution and use in source and binary forms, with or without
|
---|
| 7 | * modification, are permitted provided that the following conditions
|
---|
| 8 | * are met:
|
---|
| 9 | *
|
---|
| 10 | * - Redistributions of source code must retain the above copyright
|
---|
| 11 | * notice, this list of conditions and the following disclaimer.
|
---|
| 12 | * - Redistributions in binary form must reproduce the above copyright
|
---|
| 13 | * notice, this list of conditions and the following disclaimer in the
|
---|
| 14 | * documentation and/or other materials provided with the distribution.
|
---|
| 15 | * - The name of the author may not be used to endorse or promote products
|
---|
| 16 | * derived from this software without specific prior written permission.
|
---|
| 17 | *
|
---|
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
---|
| 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
---|
| 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
---|
| 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
---|
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
---|
| 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
---|
| 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
---|
| 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
---|
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
---|
| 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
---|
| 28 | */
|
---|
| 29 |
|
---|
| 30 | /** @addtogroup generic
|
---|
| 31 | * @{
|
---|
| 32 | */
|
---|
| 33 | /** @file
|
---|
| 34 | */
|
---|
| 35 |
|
---|
| 36 | #include <typedefs.h>
|
---|
[c0699467] | 37 | #include <abi/sysinfo.h>
|
---|
[9dae191e] | 38 | #include <sysinfo/stats.h>
|
---|
| 39 | #include <sysinfo/sysinfo.h>
|
---|
[6e121b8] | 40 | #include <synch/spinlock.h>
|
---|
| 41 | #include <synch/mutex.h>
|
---|
[9dae191e] | 42 | #include <time/clock.h>
|
---|
| 43 | #include <mm/frame.h>
|
---|
[e1b6742] | 44 | #include <proc/task.h>
|
---|
[9dae191e] | 45 | #include <proc/thread.h>
|
---|
[8eec3c8] | 46 | #include <interrupt.h>
|
---|
[9dae191e] | 47 | #include <str.h>
|
---|
| 48 | #include <errno.h>
|
---|
| 49 | #include <cpu.h>
|
---|
| 50 | #include <arch.h>
|
---|
| 51 |
|
---|
| 52 | /** Bits of fixed-point precision for load */
|
---|
| 53 | #define LOAD_FIXED_SHIFT 11
|
---|
| 54 |
|
---|
[fd3a631f] | 55 | /** Uspace load fixed-point precision */
|
---|
| 56 | #define LOAD_USPACE_SHIFT 6
|
---|
| 57 |
|
---|
| 58 | /** Kernel load shift */
|
---|
| 59 | #define LOAD_KERNEL_SHIFT (LOAD_FIXED_SHIFT - LOAD_USPACE_SHIFT)
|
---|
| 60 |
|
---|
[9dae191e] | 61 | /** 1.0 as fixed-point for load */
|
---|
| 62 | #define LOAD_FIXED_1 (1 << LOAD_FIXED_SHIFT)
|
---|
| 63 |
|
---|
| 64 | /** Compute load in 5 second intervals */
|
---|
| 65 | #define LOAD_INTERVAL 5
|
---|
| 66 |
|
---|
[80bfb601] | 67 | /** Fixed-point representation of
|
---|
[9dae191e] | 68 | *
|
---|
| 69 | * 1 / exp(5 sec / 1 min)
|
---|
| 70 | * 1 / exp(5 sec / 5 min)
|
---|
| 71 | * 1 / exp(5 sec / 15 min)
|
---|
| 72 | *
|
---|
| 73 | */
|
---|
| 74 | static load_t load_exp[LOAD_STEPS] = {1884, 2014, 2037};
|
---|
[80bfb601] | 75 |
|
---|
| 76 | /** Running average of the number of ready threads */
|
---|
[9dae191e] | 77 | static load_t avenrdy[LOAD_STEPS] = {0, 0, 0};
|
---|
[80bfb601] | 78 |
|
---|
[6e121b8] | 79 | /** Load calculation lock */
|
---|
| 80 | static mutex_t load_lock;
|
---|
[9dae191e] | 81 |
|
---|
[80bfb601] | 82 | /** Get system uptime
|
---|
| 83 | *
|
---|
| 84 | * @param item Sysinfo item (unused).
|
---|
[196c253] | 85 | * @param data Unused.
|
---|
[80bfb601] | 86 | *
|
---|
| 87 | * @return System uptime (in secords).
|
---|
| 88 | *
|
---|
| 89 | */
|
---|
[196c253] | 90 | static sysarg_t get_stats_uptime(struct sysinfo_item *item, void *data)
|
---|
[9dae191e] | 91 | {
|
---|
| 92 | /* This doesn't have to be very accurate */
|
---|
| 93 | return uptime->seconds1;
|
---|
| 94 | }
|
---|
| 95 |
|
---|
[80bfb601] | 96 | /** Get statistics of all CPUs
|
---|
| 97 | *
|
---|
[70e2b2d] | 98 | * @param item Sysinfo item (unused).
|
---|
| 99 | * @param size Size of the returned data.
|
---|
| 100 | * @param dry_run Do not get the data, just calculate the size.
|
---|
[196c253] | 101 | * @param data Unused.
|
---|
[80bfb601] | 102 | *
|
---|
| 103 | * @return Data containing several stats_cpu_t structures.
|
---|
| 104 | * If the return value is not NULL, it should be freed
|
---|
| 105 | * in the context of the sysinfo request.
|
---|
| 106 | */
|
---|
[70e2b2d] | 107 | static void *get_stats_cpus(struct sysinfo_item *item, size_t *size,
|
---|
[196c253] | 108 | bool dry_run, void *data)
|
---|
[9dae191e] | 109 | {
|
---|
[70e2b2d] | 110 | *size = sizeof(stats_cpu_t) * config.cpu_count;
|
---|
| 111 | if (dry_run)
|
---|
| 112 | return NULL;
|
---|
| 113 |
|
---|
[80bfb601] | 114 | /* Assumption: config.cpu_count is constant */
|
---|
[70e2b2d] | 115 | stats_cpu_t *stats_cpus = (stats_cpu_t *) malloc(*size, FRAME_ATOMIC);
|
---|
[9dae191e] | 116 | if (stats_cpus == NULL) {
|
---|
| 117 | *size = 0;
|
---|
| 118 | return NULL;
|
---|
| 119 | }
|
---|
| 120 |
|
---|
| 121 | size_t i;
|
---|
| 122 | for (i = 0; i < config.cpu_count; i++) {
|
---|
[da1bafb] | 123 | irq_spinlock_lock(&cpus[i].lock, true);
|
---|
[9dae191e] | 124 |
|
---|
| 125 | stats_cpus[i].id = cpus[i].id;
|
---|
[bd01a4e] | 126 | stats_cpus[i].active = cpus[i].active;
|
---|
[9dae191e] | 127 | stats_cpus[i].frequency_mhz = cpus[i].frequency_mhz;
|
---|
[d0c82c5] | 128 | stats_cpus[i].busy_cycles = cpus[i].busy_cycles;
|
---|
| 129 | stats_cpus[i].idle_cycles = cpus[i].idle_cycles;
|
---|
[9dae191e] | 130 |
|
---|
[da1bafb] | 131 | irq_spinlock_unlock(&cpus[i].lock, true);
|
---|
[9dae191e] | 132 | }
|
---|
| 133 |
|
---|
| 134 | return ((void *) stats_cpus);
|
---|
| 135 | }
|
---|
| 136 |
|
---|
[e1b6742] | 137 | /** Count number of nodes in an AVL tree
|
---|
[80bfb601] | 138 | *
|
---|
[e1b6742] | 139 | * AVL tree walker for counting nodes.
|
---|
[80bfb601] | 140 | *
|
---|
[e1b6742] | 141 | * @param node AVL tree node (unused).
|
---|
| 142 | * @param arg Pointer to the counter (size_t).
|
---|
[80bfb601] | 143 | *
|
---|
| 144 | * @param Always true (continue the walk).
|
---|
| 145 | *
|
---|
| 146 | */
|
---|
[e1b6742] | 147 | static bool avl_count_walker(avltree_node_t *node, void *arg)
|
---|
[9dae191e] | 148 | {
|
---|
| 149 | size_t *count = (size_t *) arg;
|
---|
| 150 | (*count)++;
|
---|
| 151 |
|
---|
| 152 | return true;
|
---|
| 153 | }
|
---|
| 154 |
|
---|
[dec16a2] | 155 | /** Get the size of a virtual address space
|
---|
| 156 | *
|
---|
| 157 | * @param as Address space.
|
---|
[80bfb601] | 158 | *
|
---|
[dec16a2] | 159 | * @return Size of the mapped virtual address space (bytes).
|
---|
| 160 | *
|
---|
| 161 | */
|
---|
| 162 | static size_t get_task_virtmem(as_t *as)
|
---|
| 163 | {
|
---|
[d69f959] | 164 | /*
|
---|
[fc47885] | 165 | * We are holding spinlocks here and therefore are not allowed to
|
---|
| 166 | * block. Only attempt to lock the address space and address space
|
---|
| 167 | * area mutexes conditionally. If it is not possible to lock either
|
---|
| 168 | * object, return inexact statistics by skipping the respective object.
|
---|
[d69f959] | 169 | */
|
---|
[fc47885] | 170 |
|
---|
[acda8f0] | 171 | if (SYNCH_FAILED(mutex_trylock(&as->lock)))
|
---|
[fc47885] | 172 | return 0;
|
---|
| 173 |
|
---|
| 174 | size_t pages = 0;
|
---|
[dec16a2] | 175 |
|
---|
| 176 | /* Walk the B+ tree and count pages */
|
---|
[feeac0d] | 177 | list_foreach(as->as_area_btree.leaf_list, leaf_link, btree_node_t,
|
---|
| 178 | node) {
|
---|
[dec16a2] | 179 | unsigned int i;
|
---|
| 180 | for (i = 0; i < node->keys; i++) {
|
---|
| 181 | as_area_t *area = node->value[i];
|
---|
| 182 |
|
---|
[acda8f0] | 183 | if (SYNCH_FAILED(mutex_trylock(&area->lock)))
|
---|
[d69f959] | 184 | continue;
|
---|
[fc47885] | 185 |
|
---|
| 186 | pages += area->pages;
|
---|
[dec16a2] | 187 | mutex_unlock(&area->lock);
|
---|
| 188 | }
|
---|
| 189 | }
|
---|
| 190 |
|
---|
| 191 | mutex_unlock(&as->lock);
|
---|
| 192 |
|
---|
[fc47885] | 193 | return (pages << PAGE_WIDTH);
|
---|
[dec16a2] | 194 | }
|
---|
| 195 |
|
---|
[a0ce870] | 196 | /** Get the resident (used) size of a virtual address space
|
---|
| 197 | *
|
---|
| 198 | * @param as Address space.
|
---|
| 199 | *
|
---|
| 200 | * @return Size of the resident (used) virtual address space (bytes).
|
---|
| 201 | *
|
---|
| 202 | */
|
---|
| 203 | static size_t get_task_resmem(as_t *as)
|
---|
| 204 | {
|
---|
| 205 | /*
|
---|
[fc47885] | 206 | * We are holding spinlocks here and therefore are not allowed to
|
---|
| 207 | * block. Only attempt to lock the address space and address space
|
---|
| 208 | * area mutexes conditionally. If it is not possible to lock either
|
---|
| 209 | * object, return inexact statistics by skipping the respective object.
|
---|
[a0ce870] | 210 | */
|
---|
| 211 |
|
---|
| 212 | if (SYNCH_FAILED(mutex_trylock(&as->lock)))
|
---|
[fc47885] | 213 | return 0;
|
---|
| 214 |
|
---|
| 215 | size_t pages = 0;
|
---|
[a0ce870] | 216 |
|
---|
[fc47885] | 217 | /* Walk the B+ tree and count pages */
|
---|
[feeac0d] | 218 | list_foreach(as->as_area_btree.leaf_list, leaf_link, btree_node_t, node) {
|
---|
[a0ce870] | 219 | unsigned int i;
|
---|
| 220 | for (i = 0; i < node->keys; i++) {
|
---|
| 221 | as_area_t *area = node->value[i];
|
---|
| 222 |
|
---|
| 223 | if (SYNCH_FAILED(mutex_trylock(&area->lock)))
|
---|
| 224 | continue;
|
---|
| 225 |
|
---|
[fc47885] | 226 | pages += area->resident;
|
---|
[a0ce870] | 227 | mutex_unlock(&area->lock);
|
---|
| 228 | }
|
---|
| 229 | }
|
---|
| 230 |
|
---|
| 231 | mutex_unlock(&as->lock);
|
---|
| 232 |
|
---|
[fc47885] | 233 | return (pages << PAGE_WIDTH);
|
---|
[a0ce870] | 234 | }
|
---|
| 235 |
|
---|
[dec16a2] | 236 | /* Produce task statistics
|
---|
| 237 | *
|
---|
| 238 | * Summarize task information into task statistics.
|
---|
| 239 | *
|
---|
| 240 | * @param task Task.
|
---|
| 241 | * @param stats_task Task statistics.
|
---|
| 242 | *
|
---|
| 243 | */
|
---|
| 244 | static void produce_stats_task(task_t *task, stats_task_t *stats_task)
|
---|
| 245 | {
|
---|
[1d432f9] | 246 | ASSERT(interrupts_disabled());
|
---|
| 247 | ASSERT(irq_spinlock_locked(&task->lock));
|
---|
[3d23553] | 248 |
|
---|
[dec16a2] | 249 | stats_task->task_id = task->taskid;
|
---|
| 250 | str_cpy(stats_task->name, TASK_NAME_BUFLEN, task->name);
|
---|
| 251 | stats_task->virtmem = get_task_virtmem(task->as);
|
---|
[a0ce870] | 252 | stats_task->resmem = get_task_resmem(task->as);
|
---|
[dec16a2] | 253 | stats_task->threads = atomic_get(&task->refcount);
|
---|
| 254 | task_get_accounting(task, &(stats_task->ucycles),
|
---|
| 255 | &(stats_task->kcycles));
|
---|
| 256 | stats_task->ipc_info = task->ipc_info;
|
---|
| 257 | }
|
---|
| 258 |
|
---|
| 259 | /** Gather statistics of all tasks
|
---|
| 260 | *
|
---|
| 261 | * AVL task tree walker for gathering task statistics. Interrupts should
|
---|
[80bfb601] | 262 | * be already disabled while walking the tree.
|
---|
| 263 | *
|
---|
| 264 | * @param node AVL task tree node.
|
---|
[dec16a2] | 265 | * @param arg Pointer to the iterator into the array of stats_task_t.
|
---|
[80bfb601] | 266 | *
|
---|
| 267 | * @param Always true (continue the walk).
|
---|
| 268 | *
|
---|
| 269 | */
|
---|
[9dae191e] | 270 | static bool task_serialize_walker(avltree_node_t *node, void *arg)
|
---|
| 271 | {
|
---|
[dec16a2] | 272 | stats_task_t **iterator = (stats_task_t **) arg;
|
---|
[9dae191e] | 273 | task_t *task = avltree_get_instance(node, task_t, tasks_tree_node);
|
---|
| 274 |
|
---|
[80bfb601] | 275 | /* Interrupts are already disabled */
|
---|
[da1bafb] | 276 | irq_spinlock_lock(&(task->lock), false);
|
---|
[9dae191e] | 277 |
|
---|
[dec16a2] | 278 | /* Record the statistics and increment the iterator */
|
---|
| 279 | produce_stats_task(task, *iterator);
|
---|
| 280 | (*iterator)++;
|
---|
[9dae191e] | 281 |
|
---|
[da1bafb] | 282 | irq_spinlock_unlock(&(task->lock), false);
|
---|
[9dae191e] | 283 |
|
---|
| 284 | return true;
|
---|
| 285 | }
|
---|
| 286 |
|
---|
[dec16a2] | 287 | /** Get task statistics
|
---|
[80bfb601] | 288 | *
|
---|
[70e2b2d] | 289 | * @param item Sysinfo item (unused).
|
---|
| 290 | * @param size Size of the returned data.
|
---|
| 291 | * @param dry_run Do not get the data, just calculate the size.
|
---|
[196c253] | 292 | * @param data Unused.
|
---|
[80bfb601] | 293 | *
|
---|
[dec16a2] | 294 | * @return Data containing several stats_task_t structures.
|
---|
[80bfb601] | 295 | * If the return value is not NULL, it should be freed
|
---|
| 296 | * in the context of the sysinfo request.
|
---|
| 297 | */
|
---|
[70e2b2d] | 298 | static void *get_stats_tasks(struct sysinfo_item *item, size_t *size,
|
---|
[196c253] | 299 | bool dry_run, void *data)
|
---|
[9dae191e] | 300 | {
|
---|
| 301 | /* Messing with task structures, avoid deadlock */
|
---|
[da1bafb] | 302 | irq_spinlock_lock(&tasks_lock, true);
|
---|
[9dae191e] | 303 |
|
---|
[80bfb601] | 304 | /* First walk the task tree to count the tasks */
|
---|
[9dae191e] | 305 | size_t count = 0;
|
---|
[e1b6742] | 306 | avltree_walk(&tasks_tree, avl_count_walker, (void *) &count);
|
---|
[9dae191e] | 307 |
|
---|
| 308 | if (count == 0) {
|
---|
[80bfb601] | 309 | /* No tasks found (strange) */
|
---|
[da1bafb] | 310 | irq_spinlock_unlock(&tasks_lock, true);
|
---|
[9dae191e] | 311 | *size = 0;
|
---|
| 312 | return NULL;
|
---|
| 313 | }
|
---|
| 314 |
|
---|
[dec16a2] | 315 | *size = sizeof(stats_task_t) * count;
|
---|
[70e2b2d] | 316 | if (dry_run) {
|
---|
[da1bafb] | 317 | irq_spinlock_unlock(&tasks_lock, true);
|
---|
[70e2b2d] | 318 | return NULL;
|
---|
| 319 | }
|
---|
| 320 |
|
---|
[dec16a2] | 321 | stats_task_t *stats_tasks = (stats_task_t *) malloc(*size, FRAME_ATOMIC);
|
---|
| 322 | if (stats_tasks == NULL) {
|
---|
[80bfb601] | 323 | /* No free space for allocation */
|
---|
[da1bafb] | 324 | irq_spinlock_unlock(&tasks_lock, true);
|
---|
[9dae191e] | 325 | *size = 0;
|
---|
| 326 | return NULL;
|
---|
| 327 | }
|
---|
| 328 |
|
---|
[dec16a2] | 329 | /* Walk tha task tree again to gather the statistics */
|
---|
| 330 | stats_task_t *iterator = stats_tasks;
|
---|
[9dae191e] | 331 | avltree_walk(&tasks_tree, task_serialize_walker, (void *) &iterator);
|
---|
| 332 |
|
---|
[da1bafb] | 333 | irq_spinlock_unlock(&tasks_lock, true);
|
---|
[9dae191e] | 334 |
|
---|
[dec16a2] | 335 | return ((void *) stats_tasks);
|
---|
| 336 | }
|
---|
| 337 |
|
---|
| 338 | /* Produce thread statistics
|
---|
| 339 | *
|
---|
| 340 | * Summarize thread information into thread statistics.
|
---|
| 341 | *
|
---|
| 342 | * @param thread Thread.
|
---|
| 343 | * @param stats_thread Thread statistics.
|
---|
| 344 | *
|
---|
| 345 | */
|
---|
| 346 | static void produce_stats_thread(thread_t *thread, stats_thread_t *stats_thread)
|
---|
| 347 | {
|
---|
[1d432f9] | 348 | ASSERT(interrupts_disabled());
|
---|
| 349 | ASSERT(irq_spinlock_locked(&thread->lock));
|
---|
[3d23553] | 350 |
|
---|
[dec16a2] | 351 | stats_thread->thread_id = thread->tid;
|
---|
| 352 | stats_thread->task_id = thread->task->taskid;
|
---|
| 353 | stats_thread->state = thread->state;
|
---|
| 354 | stats_thread->priority = thread->priority;
|
---|
| 355 | stats_thread->ucycles = thread->ucycles;
|
---|
| 356 | stats_thread->kcycles = thread->kcycles;
|
---|
| 357 |
|
---|
| 358 | if (thread->cpu != NULL) {
|
---|
| 359 | stats_thread->on_cpu = true;
|
---|
| 360 | stats_thread->cpu = thread->cpu->id;
|
---|
| 361 | } else
|
---|
| 362 | stats_thread->on_cpu = false;
|
---|
[9dae191e] | 363 | }
|
---|
| 364 |
|
---|
[dec16a2] | 365 | /** Gather statistics of all threads
|
---|
[e1b6742] | 366 | *
|
---|
[dec16a2] | 367 | * AVL three tree walker for gathering thread statistics. Interrupts should
|
---|
[e1b6742] | 368 | * be already disabled while walking the tree.
|
---|
| 369 | *
|
---|
| 370 | * @param node AVL thread tree node.
|
---|
[dec16a2] | 371 | * @param arg Pointer to the iterator into the array of thread statistics.
|
---|
[e1b6742] | 372 | *
|
---|
| 373 | * @param Always true (continue the walk).
|
---|
| 374 | *
|
---|
| 375 | */
|
---|
| 376 | static bool thread_serialize_walker(avltree_node_t *node, void *arg)
|
---|
| 377 | {
|
---|
[dec16a2] | 378 | stats_thread_t **iterator = (stats_thread_t **) arg;
|
---|
[e1b6742] | 379 | thread_t *thread = avltree_get_instance(node, thread_t, threads_tree_node);
|
---|
| 380 |
|
---|
| 381 | /* Interrupts are already disabled */
|
---|
[da1bafb] | 382 | irq_spinlock_lock(&thread->lock, false);
|
---|
[e1b6742] | 383 |
|
---|
[dec16a2] | 384 | /* Record the statistics and increment the iterator */
|
---|
| 385 | produce_stats_thread(thread, *iterator);
|
---|
| 386 | (*iterator)++;
|
---|
[e1b6742] | 387 |
|
---|
[da1bafb] | 388 | irq_spinlock_unlock(&thread->lock, false);
|
---|
[e1b6742] | 389 |
|
---|
| 390 | return true;
|
---|
| 391 | }
|
---|
| 392 |
|
---|
[dec16a2] | 393 | /** Get thread statistics
|
---|
[e1b6742] | 394 | *
|
---|
| 395 | * @param item Sysinfo item (unused).
|
---|
| 396 | * @param size Size of the returned data.
|
---|
| 397 | * @param dry_run Do not get the data, just calculate the size.
|
---|
[196c253] | 398 | * @param data Unused.
|
---|
[e1b6742] | 399 | *
|
---|
[dec16a2] | 400 | * @return Data containing several stats_task_t structures.
|
---|
[e1b6742] | 401 | * If the return value is not NULL, it should be freed
|
---|
| 402 | * in the context of the sysinfo request.
|
---|
| 403 | */
|
---|
| 404 | static void *get_stats_threads(struct sysinfo_item *item, size_t *size,
|
---|
[196c253] | 405 | bool dry_run, void *data)
|
---|
[e1b6742] | 406 | {
|
---|
| 407 | /* Messing with threads structures, avoid deadlock */
|
---|
[da1bafb] | 408 | irq_spinlock_lock(&threads_lock, true);
|
---|
[e1b6742] | 409 |
|
---|
| 410 | /* First walk the thread tree to count the threads */
|
---|
| 411 | size_t count = 0;
|
---|
| 412 | avltree_walk(&threads_tree, avl_count_walker, (void *) &count);
|
---|
| 413 |
|
---|
| 414 | if (count == 0) {
|
---|
| 415 | /* No threads found (strange) */
|
---|
[da1bafb] | 416 | irq_spinlock_unlock(&threads_lock, true);
|
---|
[e1b6742] | 417 | *size = 0;
|
---|
| 418 | return NULL;
|
---|
| 419 | }
|
---|
| 420 |
|
---|
[dec16a2] | 421 | *size = sizeof(stats_thread_t) * count;
|
---|
[e1b6742] | 422 | if (dry_run) {
|
---|
[da1bafb] | 423 | irq_spinlock_unlock(&threads_lock, true);
|
---|
[e1b6742] | 424 | return NULL;
|
---|
| 425 | }
|
---|
| 426 |
|
---|
[dec16a2] | 427 | stats_thread_t *stats_threads = (stats_thread_t *) malloc(*size, FRAME_ATOMIC);
|
---|
| 428 | if (stats_threads == NULL) {
|
---|
[e1b6742] | 429 | /* No free space for allocation */
|
---|
[da1bafb] | 430 | irq_spinlock_unlock(&threads_lock, true);
|
---|
[e1b6742] | 431 | *size = 0;
|
---|
| 432 | return NULL;
|
---|
| 433 | }
|
---|
| 434 |
|
---|
[dec16a2] | 435 | /* Walk tha thread tree again to gather the statistics */
|
---|
| 436 | stats_thread_t *iterator = stats_threads;
|
---|
[e1b6742] | 437 | avltree_walk(&threads_tree, thread_serialize_walker, (void *) &iterator);
|
---|
| 438 |
|
---|
[da1bafb] | 439 | irq_spinlock_unlock(&threads_lock, true);
|
---|
[e1b6742] | 440 |
|
---|
[dec16a2] | 441 | return ((void *) stats_threads);
|
---|
[e1b6742] | 442 | }
|
---|
| 443 |
|
---|
[dec16a2] | 444 | /** Get a single task statistics
|
---|
[80bfb601] | 445 | *
|
---|
| 446 | * Get statistics of a given task. The task ID is passed
|
---|
| 447 | * as a string (current limitation of the sysinfo interface,
|
---|
| 448 | * but it is still reasonable for the given purpose).
|
---|
| 449 | *
|
---|
[e1b6742] | 450 | * @param name Task ID (string-encoded number).
|
---|
| 451 | * @param dry_run Do not get the data, just calculate the size.
|
---|
[5869ce0] | 452 | * @param data Unused.
|
---|
[80bfb601] | 453 | *
|
---|
| 454 | * @return Sysinfo return holder. The type of the returned
|
---|
| 455 | * data is either SYSINFO_VAL_UNDEFINED (unknown
|
---|
| 456 | * task ID or memory allocation error) or
|
---|
| 457 | * SYSINFO_VAL_FUNCTION_DATA (in that case the
|
---|
| 458 | * generated data should be freed within the
|
---|
| 459 | * sysinfo request context).
|
---|
| 460 | *
|
---|
| 461 | */
|
---|
[5869ce0] | 462 | static sysinfo_return_t get_stats_task(const char *name, bool dry_run,
|
---|
| 463 | void *data)
|
---|
[9dae191e] | 464 | {
|
---|
[80bfb601] | 465 | /* Initially no return value */
|
---|
[9dae191e] | 466 | sysinfo_return_t ret;
|
---|
| 467 | ret.tag = SYSINFO_VAL_UNDEFINED;
|
---|
| 468 |
|
---|
[80bfb601] | 469 | /* Parse the task ID */
|
---|
[9dae191e] | 470 | task_id_t task_id;
|
---|
[059a8e4] | 471 | if (str_uint64_t(name, NULL, 0, true, &task_id) != EOK)
|
---|
[9dae191e] | 472 | return ret;
|
---|
| 473 |
|
---|
[80bfb601] | 474 | /* Messing with task structures, avoid deadlock */
|
---|
[da1bafb] | 475 | irq_spinlock_lock(&tasks_lock, true);
|
---|
[9dae191e] | 476 |
|
---|
| 477 | task_t *task = task_find_by_id(task_id);
|
---|
| 478 | if (task == NULL) {
|
---|
[80bfb601] | 479 | /* No task with this ID */
|
---|
[da1bafb] | 480 | irq_spinlock_unlock(&tasks_lock, true);
|
---|
[9dae191e] | 481 | return ret;
|
---|
| 482 | }
|
---|
| 483 |
|
---|
[e1b6742] | 484 | if (dry_run) {
|
---|
| 485 | ret.tag = SYSINFO_VAL_FUNCTION_DATA;
|
---|
| 486 | ret.data.data = NULL;
|
---|
| 487 | ret.data.size = sizeof(stats_task_t);
|
---|
| 488 |
|
---|
[da1bafb] | 489 | irq_spinlock_unlock(&tasks_lock, true);
|
---|
[e1b6742] | 490 | } else {
|
---|
| 491 | /* Allocate stats_task_t structure */
|
---|
| 492 | stats_task_t *stats_task =
|
---|
| 493 | (stats_task_t *) malloc(sizeof(stats_task_t), FRAME_ATOMIC);
|
---|
| 494 | if (stats_task == NULL) {
|
---|
[da1bafb] | 495 | irq_spinlock_unlock(&tasks_lock, true);
|
---|
[e1b6742] | 496 | return ret;
|
---|
| 497 | }
|
---|
| 498 |
|
---|
| 499 | /* Correct return value */
|
---|
| 500 | ret.tag = SYSINFO_VAL_FUNCTION_DATA;
|
---|
| 501 | ret.data.data = (void *) stats_task;
|
---|
| 502 | ret.data.size = sizeof(stats_task_t);
|
---|
[da1bafb] | 503 |
|
---|
[e1b6742] | 504 | /* Hand-over-hand locking */
|
---|
[da1bafb] | 505 | irq_spinlock_exchange(&tasks_lock, &task->lock);
|
---|
[e1b6742] | 506 |
|
---|
[dec16a2] | 507 | produce_stats_task(task, stats_task);
|
---|
[e1b6742] | 508 |
|
---|
[da1bafb] | 509 | irq_spinlock_unlock(&task->lock, true);
|
---|
[e1b6742] | 510 | }
|
---|
[9dae191e] | 511 |
|
---|
[e1b6742] | 512 | return ret;
|
---|
| 513 | }
|
---|
| 514 |
|
---|
| 515 | /** Get thread statistics
|
---|
| 516 | *
|
---|
| 517 | * Get statistics of a given thread. The thread ID is passed
|
---|
| 518 | * as a string (current limitation of the sysinfo interface,
|
---|
| 519 | * but it is still reasonable for the given purpose).
|
---|
| 520 | *
|
---|
| 521 | * @param name Thread ID (string-encoded number).
|
---|
| 522 | * @param dry_run Do not get the data, just calculate the size.
|
---|
[5869ce0] | 523 | * @param data Unused.
|
---|
[e1b6742] | 524 | *
|
---|
| 525 | * @return Sysinfo return holder. The type of the returned
|
---|
| 526 | * data is either SYSINFO_VAL_UNDEFINED (unknown
|
---|
| 527 | * thread ID or memory allocation error) or
|
---|
| 528 | * SYSINFO_VAL_FUNCTION_DATA (in that case the
|
---|
| 529 | * generated data should be freed within the
|
---|
| 530 | * sysinfo request context).
|
---|
| 531 | *
|
---|
| 532 | */
|
---|
[5869ce0] | 533 | static sysinfo_return_t get_stats_thread(const char *name, bool dry_run,
|
---|
| 534 | void *data)
|
---|
[e1b6742] | 535 | {
|
---|
| 536 | /* Initially no return value */
|
---|
| 537 | sysinfo_return_t ret;
|
---|
| 538 | ret.tag = SYSINFO_VAL_UNDEFINED;
|
---|
| 539 |
|
---|
| 540 | /* Parse the thread ID */
|
---|
| 541 | thread_id_t thread_id;
|
---|
[059a8e4] | 542 | if (str_uint64_t(name, NULL, 0, true, &thread_id) != EOK)
|
---|
[e1b6742] | 543 | return ret;
|
---|
| 544 |
|
---|
| 545 | /* Messing with threads structures, avoid deadlock */
|
---|
[da1bafb] | 546 | irq_spinlock_lock(&threads_lock, true);
|
---|
[e1b6742] | 547 |
|
---|
| 548 | thread_t *thread = thread_find_by_id(thread_id);
|
---|
| 549 | if (thread == NULL) {
|
---|
| 550 | /* No thread with this ID */
|
---|
[da1bafb] | 551 | irq_spinlock_unlock(&threads_lock, true);
|
---|
[e1b6742] | 552 | return ret;
|
---|
| 553 | }
|
---|
| 554 |
|
---|
| 555 | if (dry_run) {
|
---|
| 556 | ret.tag = SYSINFO_VAL_FUNCTION_DATA;
|
---|
| 557 | ret.data.data = NULL;
|
---|
| 558 | ret.data.size = sizeof(stats_thread_t);
|
---|
| 559 |
|
---|
[da1bafb] | 560 | irq_spinlock_unlock(&threads_lock, true);
|
---|
[e1b6742] | 561 | } else {
|
---|
| 562 | /* Allocate stats_thread_t structure */
|
---|
| 563 | stats_thread_t *stats_thread =
|
---|
| 564 | (stats_thread_t *) malloc(sizeof(stats_thread_t), FRAME_ATOMIC);
|
---|
| 565 | if (stats_thread == NULL) {
|
---|
[da1bafb] | 566 | irq_spinlock_unlock(&threads_lock, true);
|
---|
[e1b6742] | 567 | return ret;
|
---|
| 568 | }
|
---|
| 569 |
|
---|
| 570 | /* Correct return value */
|
---|
| 571 | ret.tag = SYSINFO_VAL_FUNCTION_DATA;
|
---|
| 572 | ret.data.data = (void *) stats_thread;
|
---|
| 573 | ret.data.size = sizeof(stats_thread_t);
|
---|
[dec16a2] | 574 |
|
---|
[e1b6742] | 575 | /* Hand-over-hand locking */
|
---|
[da1bafb] | 576 | irq_spinlock_exchange(&threads_lock, &thread->lock);
|
---|
[e1b6742] | 577 |
|
---|
[dec16a2] | 578 | produce_stats_thread(thread, stats_thread);
|
---|
[e1b6742] | 579 |
|
---|
[da1bafb] | 580 | irq_spinlock_unlock(&thread->lock, true);
|
---|
[e1b6742] | 581 | }
|
---|
| 582 |
|
---|
[9dae191e] | 583 | return ret;
|
---|
| 584 | }
|
---|
| 585 |
|
---|
[8eec3c8] | 586 | /** Get exceptions statistics
|
---|
| 587 | *
|
---|
| 588 | * @param item Sysinfo item (unused).
|
---|
| 589 | * @param size Size of the returned data.
|
---|
| 590 | * @param dry_run Do not get the data, just calculate the size.
|
---|
[196c253] | 591 | * @param data Unused.
|
---|
[8eec3c8] | 592 | *
|
---|
| 593 | * @return Data containing several stats_exc_t structures.
|
---|
| 594 | * If the return value is not NULL, it should be freed
|
---|
| 595 | * in the context of the sysinfo request.
|
---|
| 596 | */
|
---|
| 597 | static void *get_stats_exceptions(struct sysinfo_item *item, size_t *size,
|
---|
[196c253] | 598 | bool dry_run, void *data)
|
---|
[8eec3c8] | 599 | {
|
---|
| 600 | *size = sizeof(stats_exc_t) * IVT_ITEMS;
|
---|
| 601 |
|
---|
| 602 | if ((dry_run) || (IVT_ITEMS == 0))
|
---|
| 603 | return NULL;
|
---|
| 604 |
|
---|
| 605 | stats_exc_t *stats_exceptions =
|
---|
| 606 | (stats_exc_t *) malloc(*size, FRAME_ATOMIC);
|
---|
| 607 | if (stats_exceptions == NULL) {
|
---|
| 608 | /* No free space for allocation */
|
---|
| 609 | *size = 0;
|
---|
| 610 | return NULL;
|
---|
| 611 | }
|
---|
| 612 |
|
---|
[b3b7e14a] | 613 | #if (IVT_ITEMS > 0)
|
---|
[8eec3c8] | 614 | /* Messing with exception table, avoid deadlock */
|
---|
| 615 | irq_spinlock_lock(&exctbl_lock, true);
|
---|
| 616 |
|
---|
| 617 | unsigned int i;
|
---|
| 618 | for (i = 0; i < IVT_ITEMS; i++) {
|
---|
| 619 | stats_exceptions[i].id = i + IVT_FIRST;
|
---|
| 620 | str_cpy(stats_exceptions[i].desc, EXC_NAME_BUFLEN, exc_table[i].name);
|
---|
[b3b7e14a] | 621 | stats_exceptions[i].hot = exc_table[i].hot;
|
---|
[8eec3c8] | 622 | stats_exceptions[i].cycles = exc_table[i].cycles;
|
---|
| 623 | stats_exceptions[i].count = exc_table[i].count;
|
---|
| 624 | }
|
---|
| 625 |
|
---|
| 626 | irq_spinlock_unlock(&exctbl_lock, true);
|
---|
[b3b7e14a] | 627 | #endif
|
---|
[8eec3c8] | 628 |
|
---|
| 629 | return ((void *) stats_exceptions);
|
---|
| 630 | }
|
---|
| 631 |
|
---|
| 632 | /** Get exception statistics
|
---|
| 633 | *
|
---|
| 634 | * Get statistics of a given exception. The exception number
|
---|
| 635 | * is passed as a string (current limitation of the sysinfo
|
---|
| 636 | * interface, but it is still reasonable for the given purpose).
|
---|
| 637 | *
|
---|
| 638 | * @param name Exception number (string-encoded number).
|
---|
| 639 | * @param dry_run Do not get the data, just calculate the size.
|
---|
[5869ce0] | 640 | * @param data Unused.
|
---|
[8eec3c8] | 641 | *
|
---|
| 642 | * @return Sysinfo return holder. The type of the returned
|
---|
| 643 | * data is either SYSINFO_VAL_UNDEFINED (unknown
|
---|
| 644 | * exception number or memory allocation error) or
|
---|
| 645 | * SYSINFO_VAL_FUNCTION_DATA (in that case the
|
---|
| 646 | * generated data should be freed within the
|
---|
| 647 | * sysinfo request context).
|
---|
| 648 | *
|
---|
| 649 | */
|
---|
[5869ce0] | 650 | static sysinfo_return_t get_stats_exception(const char *name, bool dry_run,
|
---|
| 651 | void *data)
|
---|
[8eec3c8] | 652 | {
|
---|
| 653 | /* Initially no return value */
|
---|
| 654 | sysinfo_return_t ret;
|
---|
| 655 | ret.tag = SYSINFO_VAL_UNDEFINED;
|
---|
| 656 |
|
---|
| 657 | /* Parse the exception number */
|
---|
| 658 | uint64_t excn;
|
---|
[059a8e4] | 659 | if (str_uint64_t(name, NULL, 0, true, &excn) != EOK)
|
---|
[8eec3c8] | 660 | return ret;
|
---|
| 661 |
|
---|
[b3b7e14a] | 662 | #if (IVT_FIRST > 0)
|
---|
[8eec3c8] | 663 | if (excn < IVT_FIRST)
|
---|
| 664 | return ret;
|
---|
| 665 | #endif
|
---|
| 666 |
|
---|
[b3b7e14a] | 667 | #if (IVT_ITEMS + IVT_FIRST == 0)
|
---|
| 668 | return ret;
|
---|
| 669 | #else
|
---|
[8eec3c8] | 670 | if (excn >= IVT_ITEMS + IVT_FIRST)
|
---|
| 671 | return ret;
|
---|
[b3b7e14a] | 672 | #endif
|
---|
[8eec3c8] | 673 |
|
---|
| 674 | if (dry_run) {
|
---|
| 675 | ret.tag = SYSINFO_VAL_FUNCTION_DATA;
|
---|
| 676 | ret.data.data = NULL;
|
---|
| 677 | ret.data.size = sizeof(stats_thread_t);
|
---|
| 678 | } else {
|
---|
| 679 | /* Update excn index for accessing exc_table */
|
---|
| 680 | excn -= IVT_FIRST;
|
---|
| 681 |
|
---|
| 682 | /* Allocate stats_exc_t structure */
|
---|
| 683 | stats_exc_t *stats_exception =
|
---|
| 684 | (stats_exc_t *) malloc(sizeof(stats_exc_t), FRAME_ATOMIC);
|
---|
| 685 | if (stats_exception == NULL)
|
---|
| 686 | return ret;
|
---|
| 687 |
|
---|
| 688 | /* Messing with exception table, avoid deadlock */
|
---|
| 689 | irq_spinlock_lock(&exctbl_lock, true);
|
---|
| 690 |
|
---|
| 691 | /* Correct return value */
|
---|
| 692 | ret.tag = SYSINFO_VAL_FUNCTION_DATA;
|
---|
| 693 | ret.data.data = (void *) stats_exception;
|
---|
| 694 | ret.data.size = sizeof(stats_exc_t);
|
---|
| 695 |
|
---|
| 696 | stats_exception->id = excn;
|
---|
| 697 | str_cpy(stats_exception->desc, EXC_NAME_BUFLEN, exc_table[excn].name);
|
---|
[b3b7e14a] | 698 | stats_exception->hot = exc_table[excn].hot;
|
---|
[8eec3c8] | 699 | stats_exception->cycles = exc_table[excn].cycles;
|
---|
| 700 | stats_exception->count = exc_table[excn].count;
|
---|
| 701 |
|
---|
| 702 | irq_spinlock_unlock(&exctbl_lock, true);
|
---|
| 703 | }
|
---|
| 704 |
|
---|
| 705 | return ret;
|
---|
| 706 | }
|
---|
| 707 |
|
---|
[80bfb601] | 708 | /** Get physical memory statistics
|
---|
| 709 | *
|
---|
[70e2b2d] | 710 | * @param item Sysinfo item (unused).
|
---|
| 711 | * @param size Size of the returned data.
|
---|
| 712 | * @param dry_run Do not get the data, just calculate the size.
|
---|
[196c253] | 713 | * @param data Unused.
|
---|
[80bfb601] | 714 | *
|
---|
| 715 | * @return Data containing stats_physmem_t.
|
---|
| 716 | * If the return value is not NULL, it should be freed
|
---|
| 717 | * in the context of the sysinfo request.
|
---|
| 718 | */
|
---|
[70e2b2d] | 719 | static void *get_stats_physmem(struct sysinfo_item *item, size_t *size,
|
---|
[196c253] | 720 | bool dry_run, void *data)
|
---|
[9dae191e] | 721 | {
|
---|
[70e2b2d] | 722 | *size = sizeof(stats_physmem_t);
|
---|
| 723 | if (dry_run)
|
---|
| 724 | return NULL;
|
---|
| 725 |
|
---|
[9dae191e] | 726 | stats_physmem_t *stats_physmem =
|
---|
[70e2b2d] | 727 | (stats_physmem_t *) malloc(*size, FRAME_ATOMIC);
|
---|
[9dae191e] | 728 | if (stats_physmem == NULL) {
|
---|
| 729 | *size = 0;
|
---|
| 730 | return NULL;
|
---|
| 731 | }
|
---|
| 732 |
|
---|
| 733 | zones_stats(&(stats_physmem->total), &(stats_physmem->unavail),
|
---|
| 734 | &(stats_physmem->used), &(stats_physmem->free));
|
---|
| 735 |
|
---|
| 736 | return ((void *) stats_physmem);
|
---|
| 737 | }
|
---|
| 738 |
|
---|
[80bfb601] | 739 | /** Get system load
|
---|
| 740 | *
|
---|
[70e2b2d] | 741 | * @param item Sysinfo item (unused).
|
---|
| 742 | * @param size Size of the returned data.
|
---|
| 743 | * @param dry_run Do not get the data, just calculate the size.
|
---|
[196c253] | 744 | * @param data Unused.
|
---|
[80bfb601] | 745 | *
|
---|
| 746 | * @return Data several load_t values.
|
---|
| 747 | * If the return value is not NULL, it should be freed
|
---|
| 748 | * in the context of the sysinfo request.
|
---|
| 749 | */
|
---|
[70e2b2d] | 750 | static void *get_stats_load(struct sysinfo_item *item, size_t *size,
|
---|
[196c253] | 751 | bool dry_run, void *data)
|
---|
[9dae191e] | 752 | {
|
---|
[70e2b2d] | 753 | *size = sizeof(load_t) * LOAD_STEPS;
|
---|
| 754 | if (dry_run)
|
---|
| 755 | return NULL;
|
---|
| 756 |
|
---|
| 757 | load_t *stats_load = (load_t *) malloc(*size, FRAME_ATOMIC);
|
---|
[9dae191e] | 758 | if (stats_load == NULL) {
|
---|
| 759 | *size = 0;
|
---|
| 760 | return NULL;
|
---|
| 761 | }
|
---|
| 762 |
|
---|
[6e121b8] | 763 | /* To always get consistent values acquire the mutex */
|
---|
| 764 | mutex_lock(&load_lock);
|
---|
[9dae191e] | 765 |
|
---|
| 766 | unsigned int i;
|
---|
| 767 | for (i = 0; i < LOAD_STEPS; i++)
|
---|
[fd3a631f] | 768 | stats_load[i] = avenrdy[i] << LOAD_KERNEL_SHIFT;
|
---|
[9dae191e] | 769 |
|
---|
[6e121b8] | 770 | mutex_unlock(&load_lock);
|
---|
[9dae191e] | 771 |
|
---|
| 772 | return ((void *) stats_load);
|
---|
| 773 | }
|
---|
| 774 |
|
---|
| 775 | /** Calculate load
|
---|
| 776 | *
|
---|
| 777 | */
|
---|
[9efff92] | 778 | static inline load_t load_calc(load_t load, load_t exp, atomic_count_t ready)
|
---|
[9dae191e] | 779 | {
|
---|
| 780 | load *= exp;
|
---|
[9efff92] | 781 | load += (ready << LOAD_FIXED_SHIFT) * (LOAD_FIXED_1 - exp);
|
---|
[9dae191e] | 782 |
|
---|
| 783 | return (load >> LOAD_FIXED_SHIFT);
|
---|
| 784 | }
|
---|
| 785 |
|
---|
| 786 | /** Load computation thread.
|
---|
| 787 | *
|
---|
| 788 | * Compute system load every few seconds.
|
---|
| 789 | *
|
---|
| 790 | * @param arg Unused.
|
---|
| 791 | *
|
---|
| 792 | */
|
---|
| 793 | void kload(void *arg)
|
---|
| 794 | {
|
---|
| 795 | thread_detach(THREAD);
|
---|
| 796 |
|
---|
| 797 | while (true) {
|
---|
[9efff92] | 798 | atomic_count_t ready = atomic_get(&nrdy);
|
---|
| 799 |
|
---|
[80bfb601] | 800 | /* Mutually exclude with get_stats_load() */
|
---|
[6e121b8] | 801 | mutex_lock(&load_lock);
|
---|
[9dae191e] | 802 |
|
---|
| 803 | unsigned int i;
|
---|
| 804 | for (i = 0; i < LOAD_STEPS; i++)
|
---|
| 805 | avenrdy[i] = load_calc(avenrdy[i], load_exp[i], ready);
|
---|
| 806 |
|
---|
[6e121b8] | 807 | mutex_unlock(&load_lock);
|
---|
[9dae191e] | 808 |
|
---|
| 809 | thread_sleep(LOAD_INTERVAL);
|
---|
| 810 | }
|
---|
| 811 | }
|
---|
| 812 |
|
---|
[80bfb601] | 813 | /** Register sysinfo statistical items
|
---|
| 814 | *
|
---|
| 815 | */
|
---|
[9dae191e] | 816 | void stats_init(void)
|
---|
| 817 | {
|
---|
[6e121b8] | 818 | mutex_initialize(&load_lock, MUTEX_PASSIVE);
|
---|
[da1bafb] | 819 |
|
---|
[196c253] | 820 | sysinfo_set_item_gen_val("system.uptime", NULL, get_stats_uptime, NULL);
|
---|
| 821 | sysinfo_set_item_gen_data("system.cpus", NULL, get_stats_cpus, NULL);
|
---|
| 822 | sysinfo_set_item_gen_data("system.physmem", NULL, get_stats_physmem, NULL);
|
---|
| 823 | sysinfo_set_item_gen_data("system.load", NULL, get_stats_load, NULL);
|
---|
| 824 | sysinfo_set_item_gen_data("system.tasks", NULL, get_stats_tasks, NULL);
|
---|
| 825 | sysinfo_set_item_gen_data("system.threads", NULL, get_stats_threads, NULL);
|
---|
| 826 | sysinfo_set_item_gen_data("system.exceptions", NULL, get_stats_exceptions, NULL);
|
---|
[5869ce0] | 827 | sysinfo_set_subtree_fn("system.tasks", NULL, get_stats_task, NULL);
|
---|
| 828 | sysinfo_set_subtree_fn("system.threads", NULL, get_stats_thread, NULL);
|
---|
| 829 | sysinfo_set_subtree_fn("system.exceptions", NULL, get_stats_exception, NULL);
|
---|
[9dae191e] | 830 | }
|
---|
| 831 |
|
---|
| 832 | /** @}
|
---|
| 833 | */
|
---|