Changeset dec16a2 in mainline for uspace/lib/c/generic/stats.c


Ignore:
Timestamp:
2010-04-18T16:52:47Z (15 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
5c45ca8
Parents:
e535eeb
Message:
  • sysinfo items "system.tasks" and "system.threads" now return complete statistics of all tasks and threads (statistics of individual tasks and threads can be still acquited from "system.tasks.#" and "system.threads.#")
  • update user space functions accordingly
  • cleanup top — it is fully functional again
File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/generic/stats.c

    re535eeb rdec16a2  
    9696}
    9797
    98 /** Get task IDs
    99  *
    100  * @param count Number of IDs returned.
    101  *
    102  * @return Array of IDs (task_id_t).
    103  *         If non-NULL then it should be eventually freed
    104  *         by free().
    105  *
    106  */
    107 task_id_t *stats_get_tasks(size_t *count)
    108 {
    109         size_t size = 0;
    110         task_id_t *ids =
    111             (task_id_t *) sysinfo_get_data("system.tasks", &size);
    112        
    113         assert((size % sizeof(task_id_t)) == 0);
    114        
    115         *count = size / sizeof(task_id_t);
    116         return ids;
     98/** Get task statistics
     99 *
     100 * @param count Number of records returned.
     101 *
     102 * @return Array of stats_task_t structures.
     103 *         If non-NULL then it should be eventually freed
     104 *         by free().
     105 *
     106 */
     107stats_task_t *stats_get_tasks(size_t *count)
     108{
     109        size_t size = 0;
     110        stats_task_t *stats_tasks =
     111            (stats_task_t *) sysinfo_get_data("system.tasks", &size);
     112       
     113        assert((size % sizeof(stats_task_t)) == 0);
     114       
     115        *count = size / sizeof(stats_task_t);
     116        return stats_tasks;
    117117}
    118118
     
    140140}
    141141
    142 /** Get thread IDs
    143  *
    144  * @param count Number of IDs returned.
    145  *
    146  * @return Array of IDs (thread_id_t).
    147  *         If non-NULL then it should be eventually freed
    148  *         by free().
    149  *
    150  */
    151 thread_id_t *stats_get_threads(size_t *count)
    152 {
    153         size_t size = 0;
    154         thread_id_t *ids =
    155             (thread_id_t *) sysinfo_get_data("system.threads", &size);
    156        
    157         assert((size % sizeof(thread_id_t)) == 0);
    158        
    159         *count = size / sizeof(thread_id_t);
    160         return ids;
     142/** Get thread statistics.
     143 *
     144 * @param count Number of records returned.
     145 *
     146 * @return Array of stats_thread_t structures.
     147 *         If non-NULL then it should be eventually freed
     148 *         by free().
     149 *
     150 */
     151stats_thread_t *stats_get_threads(size_t *count)
     152{
     153        size_t size = 0;
     154        stats_thread_t *stats_threads =
     155            (stats_thread_t *) sysinfo_get_data("system.threads", &size);
     156       
     157        assert((size % sizeof(stats_thread_t)) == 0);
     158       
     159        *count = size / sizeof(stats_thread_t);
     160        return stats_threads;
    161161}
    162162
Note: See TracChangeset for help on using the changeset viewer.