Optimisation: only fix pending events once per lazy update
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 6 Apr 2013 00:58:48 +0000 (20:58 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Sat, 6 Apr 2013 00:58:48 +0000 (20:58 -0400)
Suggested-by: Yang Wang <yangw.wang5@unb.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
include/lttng/ust-events.h
liblttng-ust/lttng-events.c
liblttng-ust/lttng-probes.c

index d370251783d8e9778fb8878f8aceba95a5cbbf40..4cc507a05c52c1363a7ba20d0aae503955b7d3f1 100644 (file)
@@ -527,7 +527,7 @@ void synchronize_trace(void);
 
 int lttng_probe_register(struct lttng_probe_desc *desc);
 void lttng_probe_unregister(struct lttng_probe_desc *desc);
-int lttng_fix_pending_event_desc(const struct lttng_event_desc *desc);
+int lttng_fix_pending_events(void);
 int lttng_probes_init(void);
 void lttng_probes_exit(void);
 int lttng_find_context(struct lttng_ctx *ctx, const char *name);
index ca8587306c2c37b6c6f93ac7ff7cc39a2bfb13c7..e4faf605e6e0eb1d5642fc5dea1b2d4bd0ae5946 100644 (file)
@@ -635,12 +635,9 @@ int lttng_enabler_ref_events(struct lttng_enabler *enabler)
 /*
  * Called at library load: connect the probe on all enablers matching
  * this event.
- * called with session mutex held.
- * TODO: currently, for each desc added, we iterate on all event desc
- * (inefficient). We should create specific code that only target the
- * added desc.
+ * Called with session mutex held.
  */
-int lttng_fix_pending_event_desc(const struct lttng_event_desc *desc)
+int lttng_fix_pending_events(void)
 {
        struct lttng_session *session;
 
index b1d5fe28558433209f70460119125ca81b433793..f028ccab8cadd967971cb3f673b883f622b03f7e 100644 (file)
@@ -80,7 +80,6 @@ void lttng_lazy_probe_register(struct lttng_probe_desc *desc)
 {
        struct lttng_probe_desc *iter;
        struct cds_list_head *probe_list;
-       int i;
 
        /*
         * Each provider enforce that every event name begins with the
@@ -114,19 +113,6 @@ void lttng_lazy_probe_register(struct lttng_probe_desc *desc)
 desc_added:
        DBG("just registered probe %s containing %u events",
                desc->provider, desc->nr_events);
-       /*
-        * fix the events awaiting probe load.
-        */
-       for (i = 0; i < desc->nr_events; i++) {
-               const struct lttng_event_desc *ed;
-               int ret;
-
-               ed = desc->event_desc[i];
-               DBG("Registered event probe \"%s\" with signature \"%s\"",
-                       ed->name, ed->signature);
-               ret = lttng_fix_pending_event_desc(ed);
-               assert(!ret);
-       }
 }
 
 /*
@@ -136,6 +122,7 @@ static
 void fixup_lazy_probes(void)
 {
        struct lttng_probe_desc *iter, *tmp;
+       int ret;
 
        lazy_nesting++;
        cds_list_for_each_entry_safe(iter, tmp,
@@ -144,6 +131,8 @@ void fixup_lazy_probes(void)
                iter->lazy = 0;
                cds_list_del(&iter->lazy_init_head);
        }
+       ret = lttng_fix_pending_events();
+       assert(!ret);
        lazy_nesting--;
 }
 
This page took 0.027247 seconds and 4 git commands to generate.