Commit e1bfe616 authored by Florian Bezdeka's avatar Florian Bezdeka Committed by Jan Kiszka
Browse files

cobalt/registry: Adding trace events for registry_{enter,unlink,remove}



Adding the following trace events to make registry-usage traceable:
  - registry_enter   (object gets added to the registry)
  - registry_unlink  (object is made anonymous)
  - registry_remove  (object is removed from the registry)

These trace events are helpful if there is a need to track down
resource leaks triggered by an Xenomai based application.
Signed-off-by: default avatarFlorian Bezdeka <florian.bezdeka@siemens.com>
[Jan: add missing include]
Signed-off-by: Jan Kiszka's avatarJan Kiszka <jan.kiszka@siemens.com>
parent 5b337c36
......@@ -23,6 +23,7 @@
#include <cobalt/kernel/thread.h>
#include <cobalt/kernel/assert.h>
#include <pipeline/sirq.h>
#include <trace/events/cobalt-core.h>
/**
* @ingroup cobalt_core
......@@ -650,6 +651,7 @@ int xnregistry_enter(const char *key, void *objaddr,
nr_active_objects++;
object->objaddr = objaddr;
object->cstamp = ++next_object_stamp;
trace_cobalt_registry_enter(key, objaddr);
#ifdef CONFIG_XENO_OPT_VFILE
object->pnode = NULL;
#endif
......@@ -831,6 +833,8 @@ int xnregistry_remove(xnhandle_t handle)
goto unlock_and_exit;
}
trace_cobalt_registry_remove(object->key, object->objaddr);
objaddr = object->objaddr;
object->objaddr = NULL;
object->cstamp = 0;
......@@ -897,6 +901,8 @@ int xnregistry_unlink(const char *key)
goto unlock_and_exit;
}
trace_cobalt_registry_unlink(object->key, object->objaddr);
ret = registry_hash_remove(object);
if (ret < 0)
goto unlock_and_exit;
......
......@@ -26,6 +26,7 @@
#include <linux/tracepoint.h>
#include <linux/math64.h>
#include <cobalt/kernel/timer.h>
#include <cobalt/kernel/registry.h>
#include <cobalt/uapi/kernel/types.h>
struct xnsched;
......@@ -149,6 +150,23 @@ DECLARE_EVENT_CLASS(timer_event,
TP_printk("timer=%p", __entry->timer)
);
DECLARE_EVENT_CLASS(registry_event,
TP_PROTO(const char *key, void *addr),
TP_ARGS(key, addr),
TP_STRUCT__entry(
__string(key, key ?: "(anon)")
__field(void *, addr)
),
TP_fast_assign(
__assign_str(key, key ?: "(anon)");
__entry->addr = addr;
),
TP_printk("key=%s, addr=%p", __get_str(key), __entry->addr)
);
TRACE_EVENT(cobalt_schedule,
TP_PROTO(struct xnsched *sched),
TP_ARGS(sched),
......@@ -778,6 +796,21 @@ DEFINE_EVENT(synch_post_event, cobalt_synch_forget,
TP_ARGS(synch)
);
DEFINE_EVENT(registry_event, cobalt_registry_enter,
TP_PROTO(const char *key, void *addr),
TP_ARGS(key, addr)
);
DEFINE_EVENT(registry_event, cobalt_registry_remove,
TP_PROTO(const char *key, void *addr),
TP_ARGS(key, addr)
);
DEFINE_EVENT(registry_event, cobalt_registry_unlink,
TP_PROTO(const char *key, void *addr),
TP_ARGS(key, addr)
);
TRACE_EVENT(cobalt_tick_shot,
TP_PROTO(s64 delta),
TP_ARGS(delta),
......
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