* Anik Mishra ([email protected]) wrote: > -----Original Message----- > From: Mathieu Desnoyers [mailto:[email protected]] > Sent: January-16-13 10:15 AM > To: [email protected] > Subject: [lttng-dev] [RFC PATCH lttng-ust] Introduce hash table for > lttng_create_event_if_missing() > > [...] > @@ -329,17 +331,19 @@ int lttng_event_create(const struct lttng_event_desc > *desc, { > [...] > - /* > - * This is O(n^2) (for each event, the loop is called at event > - * creation). Might require a hash if we have lots of events. > - */ > - cds_list_for_each_entry(event, &chan->session->events_head, node) { > + hash = jhash(event_name, name_len, 0); > + head = &chan->session->events_ht.table[hash & (LTTNG_UST_EVENT_HT_SIZE > - 1)]; > + cds_hlist_for_each_entry(event, node, head, hlist) { > [...] > > From other code: > #define LTTNG_UST_EVENT_HT_BITS 6 > #define LTTNG_UST_EVENT_HT_SIZE (1U << LTTNG_UST_EVENT_HT_BITS) > > The way I read this, if there's a substantial number of events, > you're just dividing the time required by a constant 64. The > complexity remains the same. Are you sure this is really a long term > solution?
If we have much more than 10k _different_ TRACEPOINT_EVENT in the code, we'll probably have other issues to fix. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com _______________________________________________ lttng-dev mailing list [email protected] http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev
