source: mainline/kernel/generic/include/sysinfo/abi.h@ dec16a2

lfn serial ticket/834-toolchain-update topic/msim-upgrade topic/simplify-dev-export
Last change on this file since dec16a2 was dec16a2, checked in by Martin Decky <martin@…>, 16 years ago
  • 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
  • Property mode set to 100644
File size: 4.4 KB
Line 
1/*
2 * Copyright (c) 2010 Martin Decky
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * - Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * - Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * - The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29/** @addtogroup generic
30 * @{
31 */
32/** @file
33 * Data structures passed between kernel sysinfo and user space.
34 */
35
36#ifndef KERN_ABI_H_
37#define KERN_ABI_H_
38
39/** Number of load components */
40#define LOAD_STEPS 3
41
42/** Maximum task name size */
43#define TASK_NAME_BUFLEN 20
44
45/** Thread states */
46typedef enum {
47 /** It is an error, if thread is found in this state. */
48 Invalid,
49 /** State of a thread that is currently executing on some CPU. */
50 Running,
51 /** Thread in this state is waiting for an event. */
52 Sleeping,
53 /** State of threads in a run queue. */
54 Ready,
55 /** Threads are in this state before they are first readied. */
56 Entering,
57 /** After a thread calls thread_exit(), it is put into Exiting state. */
58 Exiting,
59 /** Threads that were not detached but exited are Lingering. */
60 Lingering
61} state_t;
62
63/** Statistics about a single CPU
64 *
65 */
66typedef struct {
67 unsigned int id; /**< CPU ID as stored by kernel */
68 uint16_t frequency_mhz; /**< Frequency in MHz */
69 uint64_t idle_ticks; /**< Number of idle kernel quanta */
70 uint64_t busy_ticks; /**< Number of busy kernel quanta */
71} stats_cpu_t;
72
73/** Physical memory statistics
74 *
75 */
76typedef struct {
77 uint64_t total; /**< Total physical memory (bytes) */
78 uint64_t unavail; /**< Unavailable (reserved, firmware) bytes */
79 uint64_t used; /**< Allocated physical memory (bytes) */
80 uint64_t free; /**< Free physical memory (bytes) */
81} stats_physmem_t;
82
83/** IPC statistics
84 *
85 * Associated with a task.
86 *
87 */
88typedef struct {
89 uint64_t call_sent; /**< IPC calls sent */
90 uint64_t call_recieved; /**< IPC calls received */
91 uint64_t answer_sent; /**< IPC answers sent */
92 uint64_t answer_recieved; /**< IPC answers received */
93 uint64_t irq_notif_recieved; /**< IPC IRQ notifications */
94 uint64_t forwarded; /**< IPC messages forwarded */
95} stats_ipc_t;
96
97/** Statistics about a single task
98 *
99 */
100typedef struct {
101 task_id_t task_id; /**< Task ID */
102 char name[TASK_NAME_BUFLEN]; /**< Task name (in kernel) */
103 size_t virtmem; /**< Size of VAS (bytes) */
104 size_t threads; /**< Number of threads */
105 uint64_t ucycles; /**< Number of CPU cycles in user space */
106 uint64_t kcycles; /**< Number of CPU cycles in kernel */
107 stats_ipc_t ipc_info; /**< IPC statistics */
108} stats_task_t;
109
110/** Statistics about a single thread
111 *
112 */
113typedef struct {
114 thread_id_t thread_id; /**< Thread ID */
115 task_id_t task_id; /**< Associated task ID */
116 state_t state; /**< Thread state */
117 int priority; /**< Thread priority */
118 uint64_t ucycles; /**< Number of CPU cycles in user space */
119 uint64_t kcycles; /**< Number of CPU cycles in kernel */
120 bool on_cpu; /**< Associated with a CPU */
121 unsigned int cpu; /**< Associated CPU ID (if on_cpu is true) */
122} stats_thread_t;
123
124/** Load fixed-point value */
125typedef uint32_t load_t;
126
127#endif
128
129/** @}
130 */
Note: See TracBrowser for help on using the repository browser.