42 #define N_STAT_TYPES sizeof(stat_types) / sizeof(*stat_types)
46 if (!stats_initialized) { \
47 log_warn("Statistics not initialized"); \
54 if (stat_types[i].
id ==
id) {
55 return &stat_types[i];
79 if (type->
items == NULL) {
86 unsigned int runtime_id,
unsigned int thread_id) {
90 int item_id = runtime_id *
MAX_THREADS + thread_id ;
109 log_warn(
"Item ID %u not assigned", item_id);
135 log_error(
"Item ID %u too high!", item_id);
144 log_warn(
"Item ID %u already assigned index %d",
148 log(LOG_STATS,
"Allocating new msu stat item: %u", item_id);
153 if (new_item != NULL) {
154 type->
items = new_item;
156 log_error(
"Error reallocating stat item");
175 log_warn(
"Couldn't register msu %u", msu_id);
185 log_warn(
"Couldn't register thread %u", thread_id);
194 log_error(
"Statistics already initialized");
202 stat_types[i].
items = NULL;
209 log_error(
"DFG must be initialized before initializing statistics");
220 for (
int i=0; i < dfg->
n_msus; i++) {
static bool stats_initialized
int unregister_msu_stats(unsigned int msu_id)
int n_msus
The number of MSUs in dedos_dfg::msus.
Round-robin database (circular buffer) for storing timeseries data.
int unregister_thread_stats(unsigned int thread_id, unsigned int runtime_id)
struct dfg_scheduling scheduling
Information about where an MSU is scheduled.
#define MAX_THREADS
The maximum number of threads that may be present on a runtime.
static struct stat_type stat_types[]
static struct stat_type_label reported_msu_stat_types[]
stat_id
The identifiers with which stats can be logged.
int init_stats_msg_handler()
struct stat_item * items
The items of this type being logged.
static int unregister_stat(enum stat_id stat_id, unsigned int item_id)
int id
Unique identifier for the runtime.
static struct stat_type * get_stat_type(enum stat_id id)
unsigned int id
A unique identifier for the item being logged.
Logging of status messages to the terminal.
struct timed_rrdb * get_msu_stat(enum stat_id id, unsigned int msu_id)
Functions for the sending and receiving of statistics between ctrl and runtime.
struct dfg_msu_type * type
The type of the MSU and meta-routing information.
#define REPORTED_STAT_TYPES
Representation of a runtime in the DFG.
The structure holding all items of a type of stats.
The internal statistics structure where stats are aggregated One per statistic-item.
struct dfg_runtime * runtime
The runtime on which an MSU is running.
int register_msu_stats(unsigned int msu_id, int msu_type_id, int thread_id, int runtime_id)
int n_runtimes
The number of elements in dedos_dfg::runtimes.
#define N_REPORTED_MSU_STAT_TYPES
#define log_error(fmt,...)
int id
A unique identifier for the MSU.
int n_unpinned_threads
Number of the above-threads which are unpinned.
#define RRDB_ENTRIES
timeseries.h
struct dfg_thread * thread
The thread on which an MSU is running.
#define N_REPORTED_STAT_TYPES
Number of reported stat types.
int id
Unique identifier for the thread.
Representation of a single MSU in the dfg.
static struct stat_type_label reported_thread_stat_types[]
int register_stat(enum stat_id stat_id, unsigned int item_id)
int n_pinned_threads
Number of the above-threads which are pinned.
int id
A unique identifier for the MSU type.
enum stat_id id
Stat ID as defined in stats.h.
static struct timed_rrdb * get_stat(enum stat_id id, unsigned int item_id)
int num_items
Number of items currently registered for logging.
Top-level structure holding the data-flow graph.
static struct dedos_dfg * dfg
Static local copy of the DFG, so each call doesn't have to pass a copy.
void print_timeseries(struct timed_rrdb *timeseries)
Prints the beginning and end of a timeseries.
struct timed_stat * stats
Timestamp and data for each gathered statistic.
int register_thread_stats(unsigned int thread_id, unsigned int runtime_id)
int db_register_thread_stats(int thread_id, int runtime_id)
struct dfg_runtime * runtimes[16]
The runtimes present in the application.
struct dfg_thread * threads[32]
Threads located on the runtime.
int db_register_msu_stats(int msu_id, int msu_type_id, int thread_id, int runtime_id)
static int runtime_id(int runtime_fd)
#define log(level, fmt,...)
Log at a custom level.
struct dedos_dfg * get_dfg()
int id_indices[MAX_STAT_ITEM_ID]
Index at which the IDs are stored.
#define N_REPORTED_THREAD_STAT_TYPES
struct timed_rrdb * get_thread_stat(enum stat_id id, unsigned int runtime_id, unsigned int thread_id)
#define log_warn(fmt,...)
void show_stats(struct dfg_msu *msu)
struct dfg_msu * msus[512]
The MSUs present in the application.
int init_statistics()
Initializes the entire stats module.