projects
/
lttng-ust.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
benchmark tool
[lttng-ust.git]
/
libust
/
channels.c
diff --git
a/libust/channels.c
b/libust/channels.c
index 27ceefc6d6a1cd7921ebb09f91c6d585615348e3..abb2986c4689a4354d7e49648ea9ce7ca2f0e91a 100644
(file)
--- a/
libust/channels.c
+++ b/
libust/channels.c
@@
-23,15
+23,11
@@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-//ust// #include <linux/module.h>
-//ust// #include <linux/ltt-channels.h>
-//ust// #include <linux/mutex.h>
-//ust// #include <linux/vmalloc.h>
-
+#include <stdlib.h>
#include <ust/kernelcompat.h>
#include <ust/kernelcompat.h>
+#include <ust/marker.h>
#include "channels.h"
#include "usterr.h"
#include "channels.h"
#include "usterr.h"
-#include <ust/marker.h>
/*
* ltt_channel_mutex may be nested inside the LTT trace mutex.
/*
* ltt_channel_mutex may be nested inside the LTT trace mutex.
@@
-72,16
+68,17
@@
static void release_channel_setting(struct kref *kref)
struct ltt_channel_setting, kref);
struct ltt_channel_setting *iter;
struct ltt_channel_setting, kref);
struct ltt_channel_setting *iter;
- if (atomic_read(&index_kref.refcount) == 0
- && atomic_read(&setting->kref.refcount) == 0) {
+ if (
u
atomic_read(&index_kref.refcount) == 0
+ &&
u
atomic_read(&setting->kref.refcount) == 0) {
list_del(&setting->list);
list_del(&setting->list);
-
k
free(setting);
+ free(setting);
free_index = 0;
list_for_each_entry(iter, <t_channels, list) {
iter->index = free_index++;
iter->free_event_id = 0;
}
free_index = 0;
list_for_each_entry(iter, <t_channels, list) {
iter->index = free_index++;
iter->free_event_id = 0;
}
+ /* FIXME: why not run this? */
//ust// markers_compact_event_ids();
}
}
//ust// markers_compact_event_ids();
}
}
@@
-113,14
+110,14
@@
int ltt_channels_register(const char *name)
mutex_lock(<t_channel_mutex);
setting = lookup_channel(name);
if (setting) {
mutex_lock(<t_channel_mutex);
setting = lookup_channel(name);
if (setting) {
- if (atomic_read(&setting->kref.refcount) == 0)
+ if (
u
atomic_read(&setting->kref.refcount) == 0)
goto init_kref;
else {
kref_get(&setting->kref);
goto end;
}
}
goto init_kref;
else {
kref_get(&setting->kref);
goto end;
}
}
- setting =
kzalloc(sizeof(*setting), GFP_KERNEL
);
+ setting =
zmalloc(sizeof(*setting)
);
if (!setting) {
ret = -ENOMEM;
goto end;
if (!setting) {
ret = -ENOMEM;
goto end;
@@
-149,7
+146,7
@@
int ltt_channels_unregister(const char *name)
mutex_lock(<t_channel_mutex);
setting = lookup_channel(name);
mutex_lock(<t_channel_mutex);
setting = lookup_channel(name);
- if (!setting || atomic_read(&setting->kref.refcount) == 0) {
+ if (!setting ||
u
atomic_read(&setting->kref.refcount) == 0) {
ret = -ENOENT;
goto end;
}
ret = -ENOENT;
goto end;
}
@@
-175,7
+172,7
@@
int ltt_channels_set_default(const char *name,
mutex_lock(<t_channel_mutex);
setting = lookup_channel(name);
mutex_lock(<t_channel_mutex);
setting = lookup_channel(name);
- if (!setting || atomic_read(&setting->kref.refcount) == 0) {
+ if (!setting ||
u
atomic_read(&setting->kref.refcount) == 0) {
ret = -ENOENT;
goto end;
}
ret = -ENOENT;
goto end;
}
@@
-199,7
+196,7
@@
const char *ltt_channels_get_name_from_index(unsigned int index)
struct ltt_channel_setting *iter;
list_for_each_entry(iter, <t_channels, list)
struct ltt_channel_setting *iter;
list_for_each_entry(iter, <t_channels, list)
- if (iter->index == index && atomic_read(&iter->kref.refcount))
+ if (iter->index == index &&
u
atomic_read(&iter->kref.refcount))
return iter->name;
return NULL;
}
return iter->name;
return NULL;
}
@@
-212,7
+209,7
@@
ltt_channels_get_setting_from_name(const char *name)
list_for_each_entry(iter, <t_channels, list)
if (!strcmp(iter->name, name)
list_for_each_entry(iter, <t_channels, list)
if (!strcmp(iter->name, name)
- && atomic_read(&iter->kref.refcount))
+ &&
u
atomic_read(&iter->kref.refcount))
return iter;
return NULL;
}
return iter;
return NULL;
}
@@
-247,11
+244,11
@@
int ltt_channels_get_index_from_name(const char *name)
* Called with trace lock held. Does not perform the trace buffer allocation,
* because we must let the user overwrite specific channel sizes.
*/
* Called with trace lock held. Does not perform the trace buffer allocation,
* because we must let the user overwrite specific channel sizes.
*/
-struct
ltt_channel_struct
*ltt_channels_trace_alloc(unsigned int *nr_channels,
+struct
ust_channel
*ltt_channels_trace_alloc(unsigned int *nr_channels,
int overwrite,
int active)
{
int overwrite,
int active)
{
- struct
ltt_channel_struct
*channel = NULL;
+ struct
ust_channel
*channel = NULL;
struct ltt_channel_setting *iter;
mutex_lock(<t_channel_mutex);
struct ltt_channel_setting *iter;
mutex_lock(<t_channel_mutex);
@@
-259,19
+256,18
@@
struct ltt_channel_struct *ltt_channels_trace_alloc(unsigned int *nr_channels,
WARN("ltt_channels_trace_alloc: no free_index; are there any probes connected?");
goto end;
}
WARN("ltt_channels_trace_alloc: no free_index; are there any probes connected?");
goto end;
}
- if (!atomic_read(&index_kref.refcount))
+ if (!
u
atomic_read(&index_kref.refcount))
kref_init(&index_kref);
else
kref_get(&index_kref);
*nr_channels = free_index;
kref_init(&index_kref);
else
kref_get(&index_kref);
*nr_channels = free_index;
- channel = kzalloc(sizeof(struct ltt_channel_struct) * free_index,
- GFP_KERNEL);
+ channel = zmalloc(sizeof(struct ust_channel) * free_index);
if (!channel) {
WARN("ltt_channel_struct: channel null after alloc");
goto end;
}
list_for_each_entry(iter, <t_channels, list) {
if (!channel) {
WARN("ltt_channel_struct: channel null after alloc");
goto end;
}
list_for_each_entry(iter, <t_channels, list) {
- if (!atomic_read(&iter->kref.refcount))
+ if (!
u
atomic_read(&iter->kref.refcount))
continue;
channel[iter->index].subbuf_size = iter->subbuf_size;
channel[iter->index].subbuf_cnt = iter->subbuf_cnt;
continue;
channel[iter->index].subbuf_size = iter->subbuf_size;
channel[iter->index].subbuf_cnt = iter->subbuf_cnt;
@@
-292,11
+288,11
@@
end:
* Called with trace lock held. The actual channel buffers must be freed before
* this function is called.
*/
* Called with trace lock held. The actual channel buffers must be freed before
* this function is called.
*/
-void ltt_channels_trace_free(struct
ltt_channel_struct
*channels)
+void ltt_channels_trace_free(struct
ust_channel
*channels)
{
lock_markers();
mutex_lock(<t_channel_mutex);
{
lock_markers();
mutex_lock(<t_channel_mutex);
-
k
free(channels);
+ free(channels);
kref_put(&index_kref, release_trace_channel);
mutex_unlock(<t_channel_mutex);
unlock_markers();
kref_put(&index_kref, release_trace_channel);
mutex_unlock(<t_channel_mutex);
unlock_markers();
This page took
0.027333 seconds
and
4
git commands to generate.