Commit 05ea3c68 authored by Philippe Gerum's avatar Philippe Gerum
Browse files

cobalt/timer: assign handler identifier as default timer name

Timer name and handler name are redundant. Drop the latter, but assign
it as the timer's default name until xntimer_set_name() is called.
parent a7147eb6
......@@ -23,6 +23,7 @@
#include <cobalt/kernel/clock.h>
#include <cobalt/kernel/stat.h>
#include <cobalt/kernel/list.h>
#include <cobalt/kernel/ancillaries.h>
/**
* @addtogroup cobalt_core_timer
......@@ -215,8 +216,6 @@ struct xntimer {
#endif
/** Timer name to be displayed. */
char name[XNOBJECT_NAME_LEN];
/** Handler name to be displayed. */
const char *handler_name;
/** Timer holder in timebase. */
struct list_head next_stat;
/** Number of timer schedules. */
......@@ -330,7 +329,7 @@ void xntimer_set_gravity(struct xntimer *timer,
#define xntimer_init(__timer, __clock, __handler, __thread, __flags) \
do { \
__xntimer_init(__timer, __clock, __handler, __thread, __flags); \
(__timer)->handler_name = #__handler; \
xntimer_set_name(__timer, #__handler); \
} while (0)
static inline void xntimer_reset_stats(struct xntimer *timer)
......@@ -351,7 +350,7 @@ static inline void xntimer_account_fired(struct xntimer *timer)
static inline void xntimer_set_name(struct xntimer *timer, const char *name)
{
strncpy(timer->name, name, sizeof(timer->name));
knamecpy(timer->name, name);
}
#else /* !CONFIG_XENO_OPT_STATS */
......
......@@ -355,7 +355,6 @@ struct vfile_clock_data {
xnticks_t timeout;
xnticks_t interval;
unsigned long status;
char handler[XNOBJECT_NAME_LEN];
char name[XNOBJECT_NAME_LEN];
};
......@@ -398,7 +397,6 @@ static int timerlist_next(struct xnvfile_snapshot_iterator *it, void *data)
p->timeout = xntimer_get_timeout(timer);
p->interval = xntimer_interval(timer);
p->status = timer->status;
knamecpy(p->handler, timer->handler_name);
knamecpy(p->name, timer->name);
return 1;
......@@ -413,9 +411,9 @@ static int timerlist_show(struct xnvfile_snapshot_iterator *it, void *data)
if (p == NULL)
xnvfile_printf(it,
"%-3s %-20s %-10s %-10s %-16s %s\n",
"%-3s %-20s %-10s %-10s %s\n",
"CPU", "SCHED/SHOT", "TIMEOUT",
"INTERVAL", "HANDLER", "NAME");
"INTERVAL", "NAME");
else {
if ((p->status & XNTIMER_DEQUEUED) == 0)
xntimer_format_time(p->timeout, timeout_buf,
......@@ -426,9 +424,9 @@ static int timerlist_show(struct xnvfile_snapshot_iterator *it, void *data)
ksformat(hit_buf, sizeof(hit_buf), "%u/%u",
p->scheduled, p->fired);
xnvfile_printf(it,
"%-3u %-20s %-10s %-10s %-16s %s\n",
"%-3u %-20s %-10s %-10s %s\n",
p->cpu, hit_buf, timeout_buf,
interval_buf, p->handler, p->name);
interval_buf, p->name);
}
return 0;
......
......@@ -556,7 +556,7 @@ TRACE_EVENT(cobalt_timer_start,
TP_STRUCT__entry(
__field(struct xntimer *, timer)
#ifdef CONFIG_XENO_OPT_STATS
__string(handler, timer->handler_name)
__string(name, timer->name)
#endif
__field(xnticks_t, value)
__field(xnticks_t, interval)
......@@ -566,7 +566,7 @@ TRACE_EVENT(cobalt_timer_start,
TP_fast_assign(
__entry->timer = timer;
#ifdef CONFIG_XENO_OPT_STATS
__assign_str(handler, timer->handler_name);
__assign_str(name, timer->name);
#endif
__entry->value = value;
__entry->interval = interval;
......@@ -576,7 +576,7 @@ TRACE_EVENT(cobalt_timer_start,
TP_printk("timer=%p(%s) value=%Lu interval=%Lu mode=%s",
__entry->timer,
#ifdef CONFIG_XENO_OPT_STATS
__get_str(handler),
__get_str(name),
#else
"(anon)",
#endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment