projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
action list: missing renames from previous name "group"
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
event-notifier-error-accounting.c
diff --git
a/src/bin/lttng-sessiond/event-notifier-error-accounting.c
b/src/bin/lttng-sessiond/event-notifier-error-accounting.c
index 70fa39e023d4466431614e9499fde0d8797de2c7..e7b2def91c4b2675d7500c6c8c664e39e1339fb6 100644
(file)
--- a/
src/bin/lttng-sessiond/event-notifier-error-accounting.c
+++ b/
src/bin/lttng-sessiond/event-notifier-error-accounting.c
@@
-36,13
+36,13
@@
struct ust_error_accounting_entry {
struct urcu_ref ref;
struct lttng_ht_node_u64 node;
struct rcu_head rcu_head;
struct urcu_ref ref;
struct lttng_ht_node_u64 node;
struct rcu_head rcu_head;
- struct
ust
ctl_daemon_counter *daemon_counter;
+ struct
lttng_ust_
ctl_daemon_counter *daemon_counter;
/*
* Those `lttng_ust_abi_object_data` are anonymous handles to the
* counters objects.
* They are only used to be duplicated for each new applications of the
* user. To destroy them, call with the `sock` parameter set to -1.
/*
* Those `lttng_ust_abi_object_data` are anonymous handles to the
* counters objects.
* They are only used to be duplicated for each new applications of the
* user. To destroy them, call with the `sock` parameter set to -1.
- * e.g. `
ust
ctl_release_object(-1, data)`;
+ * e.g. `
lttng_ust_
ctl_release_object(-1, data)`;
*/
struct lttng_ust_abi_object_data *counter;
struct lttng_ust_abi_object_data **cpu_counters;
*/
struct lttng_ust_abi_object_data *counter;
struct lttng_ust_abi_object_data **cpu_counters;
@@
-127,16
+127,16
@@
static void free_ust_error_accounting_entry(struct rcu_head *head)
caa_container_of(head, typeof(*entry), rcu_head);
for (i = 0; i < entry->nr_counter_cpu_fds; i++) {
caa_container_of(head, typeof(*entry), rcu_head);
for (i = 0; i < entry->nr_counter_cpu_fds; i++) {
-
ust
ctl_release_object(-1, entry->cpu_counters[i]);
+
lttng_ust_
ctl_release_object(-1, entry->cpu_counters[i]);
free(entry->cpu_counters[i]);
}
free(entry->cpu_counters);
free(entry->cpu_counters[i]);
}
free(entry->cpu_counters);
-
ust
ctl_release_object(-1, entry->counter);
+
lttng_ust_
ctl_release_object(-1, entry->counter);
free(entry->counter);
free(entry->counter);
-
ust
ctl_destroy_counter(entry->daemon_counter);
+
lttng_ust_
ctl_destroy_counter(entry->daemon_counter);
free(entry);
}
free(entry);
}
@@
-372,15
+372,21
@@
struct ust_error_accounting_entry *ust_error_accounting_entry_create(
struct lttng_ht *uid_ht, const struct ust_app *app)
{
int i, ret, *cpu_counter_fds = NULL;
struct lttng_ht *uid_ht, const struct ust_app *app)
{
int i, ret, *cpu_counter_fds = NULL;
- struct
ust
ctl_daemon_counter *daemon_counter;
+ struct
lttng_ust_
ctl_daemon_counter *daemon_counter;
struct lttng_ust_abi_object_data *counter, **cpu_counters;
struct ust_error_accounting_entry *entry = NULL;
struct lttng_ust_abi_object_data *counter, **cpu_counters;
struct ust_error_accounting_entry *entry = NULL;
- const struct
ust
ctl_counter_dimension dimension = {
+ const struct
lttng_ust_
ctl_counter_dimension dimension = {
.size = ust_state.number_indices,
.has_underflow = false,
.has_overflow = false,
};
.size = ust_state.number_indices,
.has_underflow = false,
.has_overflow = false,
};
+ if (!ust_app_supports_counters(app)) {
+ DBG("Refusing to create accounting entry for application (unsupported feature): app name = '%s', app ppid = %d",
+ app->name, (int) app->ppid);
+ goto error;
+ }
+
entry = zmalloc(sizeof(struct ust_error_accounting_entry));
if (!entry) {
PERROR("Failed to allocate event notifier error acounting entry")
entry = zmalloc(sizeof(struct ust_error_accounting_entry));
if (!entry) {
PERROR("Failed to allocate event notifier error acounting entry")
@@
-389,7
+395,7
@@
struct ust_error_accounting_entry *ust_error_accounting_entry_create(
urcu_ref_init(&entry->ref);
entry->uid = app->uid;
urcu_ref_init(&entry->ref);
entry->uid = app->uid;
- entry->nr_counter_cpu_fds =
ust
ctl_get_nr_cpu_per_counter();
+ entry->nr_counter_cpu_fds =
lttng_ust_
ctl_get_nr_cpu_per_counter();
cpu_counter_fds = zmalloc(entry->nr_counter_cpu_fds * sizeof(*cpu_counter_fds));
if (!cpu_counter_fds) {
cpu_counter_fds = zmalloc(entry->nr_counter_cpu_fds * sizeof(*cpu_counter_fds));
if (!cpu_counter_fds) {
@@
-424,17
+430,17
@@
struct ust_error_accounting_entry *ust_error_accounting_entry_create(
/*
* Ownership of the file descriptors transferred to the ustctl object.
*/
/*
* Ownership of the file descriptors transferred to the ustctl object.
*/
- daemon_counter =
ust
ctl_create_counter(1, &dimension, 0, -1,
+ daemon_counter =
lttng_ust_
ctl_create_counter(1, &dimension, 0, -1,
entry->nr_counter_cpu_fds, cpu_counter_fds,
entry->nr_counter_cpu_fds, cpu_counter_fds,
-
UST
CTL_COUNTER_BITNESS_32,
-
UST
CTL_COUNTER_ARITHMETIC_MODULAR,
-
UST
CTL_COUNTER_ALLOC_PER_CPU,
+
LTTNG_UST_
CTL_COUNTER_BITNESS_32,
+
LTTNG_UST_
CTL_COUNTER_ARITHMETIC_MODULAR,
+
LTTNG_UST_
CTL_COUNTER_ALLOC_PER_CPU,
false);
if (!daemon_counter) {
goto error_create_daemon_counter;
}
false);
if (!daemon_counter) {
goto error_create_daemon_counter;
}
- ret =
ust
ctl_create_counter_data(daemon_counter, &counter);
+ ret =
lttng_ust_
ctl_create_counter_data(daemon_counter, &counter);
if (ret) {
ERR("Failed to create userspace tracer counter data for application user: uid = %d, pid = %d, application name = '%s'",
(int) app->uid, (int) app->pid, app->name);
if (ret) {
ERR("Failed to create userspace tracer counter data for application user: uid = %d, pid = %d, application name = '%s'",
(int) app->uid, (int) app->pid, app->name);
@@
-442,7
+448,7
@@
struct ust_error_accounting_entry *ust_error_accounting_entry_create(
}
for (i = 0; i < entry->nr_counter_cpu_fds; i++) {
}
for (i = 0; i < entry->nr_counter_cpu_fds; i++) {
- ret =
ust
ctl_create_counter_cpu_data(daemon_counter, i,
+ ret =
lttng_ust_
ctl_create_counter_cpu_data(daemon_counter, i,
&cpu_counters[i]);
if (ret) {
ERR("Failed to create userspace tracer counter cpu data for application user: uid = %d, pid = %d, application name = '%s'",
&cpu_counters[i]);
if (ret) {
ERR("Failed to create userspace tracer counter cpu data for application user: uid = %d, pid = %d, application name = '%s'",
@@
-472,14
+478,14
@@
error_create_counter_cpu_data:
break;
}
break;
}
-
ust
ctl_release_object(-1, cpu_counters[i]);
+
lttng_ust_
ctl_release_object(-1, cpu_counters[i]);
free(cpu_counters[i]);
}
free(cpu_counters[i]);
}
-
ust
ctl_release_object(-1, entry->counter);
+
lttng_ust_
ctl_release_object(-1, entry->counter);
free(entry->counter);
error_create_counter_data:
free(entry->counter);
error_create_counter_data:
-
ust
ctl_destroy_counter(daemon_counter);
+
lttng_ust_
ctl_destroy_counter(daemon_counter);
error_create_daemon_counter:
error_shm_alloc:
/* Error occured before per-cpu SHMs were handed-off to ustctl. */
error_create_daemon_counter:
error_shm_alloc:
/* Error occured before per-cpu SHMs were handed-off to ustctl. */
@@
-522,7
+528,7
@@
enum event_notifier_error_accounting_status send_counter_data_to_ust(
/* Attach counter to trigger group. */
pthread_mutex_lock(&app->sock_lock);
/* Attach counter to trigger group. */
pthread_mutex_lock(&app->sock_lock);
- ret =
ust
ctl_send_counter_data_to_ust(app->sock,
+ ret =
lttng_ust_
ctl_send_counter_data_to_ust(app->sock,
app->event_notifier_group.object->handle, new_counter);
pthread_mutex_unlock(&app->sock_lock);
if (ret < 0) {
app->event_notifier_group.object->handle, new_counter);
pthread_mutex_unlock(&app->sock_lock);
if (ret < 0) {
@@
-554,7
+560,7
@@
enum event_notifier_error_accounting_status send_counter_cpu_data_to_ust(
enum event_notifier_error_accounting_status status;
pthread_mutex_lock(&app->sock_lock);
enum event_notifier_error_accounting_status status;
pthread_mutex_lock(&app->sock_lock);
- ret =
ust
ctl_send_counter_cpu_data_to_ust(app->sock,
+ ret =
lttng_ust_
ctl_send_counter_cpu_data_to_ust(app->sock,
counter, counter_cpu);
pthread_mutex_unlock(&app->sock_lock);
if (ret < 0) {
counter, counter_cpu);
pthread_mutex_unlock(&app->sock_lock);
if (ret < 0) {
@@
-586,6
+592,11
@@
event_notifier_error_accounting_register_app(struct ust_app *app)
enum event_notifier_error_accounting_status status;
struct lttng_ust_abi_object_data **cpu_counters;
enum event_notifier_error_accounting_status status;
struct lttng_ust_abi_object_data **cpu_counters;
+ if (!ust_app_supports_counters(app)) {
+ status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_UNSUPPORTED;
+ goto end;
+ }
+
/*
* Check if we already have a error counter for the user id of this
* app. If not, create one.
/*
* Check if we already have a error counter for the user id of this
* app. If not, create one.
@@
-621,7
+632,7
@@
event_notifier_error_accounting_register_app(struct ust_app *app)
}
/* Duplicate counter object data. */
}
/* Duplicate counter object data. */
- ret =
ust
ctl_duplicate_ust_object_data(&new_counter,
+ ret =
lttng_ust_
ctl_duplicate_ust_object_data(&new_counter,
entry->counter);
if (ret) {
ERR("Failed to duplicate event notifier error accounting counter for application user: application uid = %d, pid = %d, application name = '%s'",
entry->counter);
if (ret) {
ERR("Failed to duplicate event notifier error accounting counter for application user: application uid = %d, pid = %d, application name = '%s'",
@@
-655,7
+666,7
@@
event_notifier_error_accounting_register_app(struct ust_app *app)
for (i = 0; i < entry->nr_counter_cpu_fds; i++) {
struct lttng_ust_abi_object_data *new_counter_cpu = NULL;
for (i = 0; i < entry->nr_counter_cpu_fds; i++) {
struct lttng_ust_abi_object_data *new_counter_cpu = NULL;
- ret =
ust
ctl_duplicate_ust_object_data(&new_counter_cpu,
+ ret =
lttng_ust_
ctl_duplicate_ust_object_data(&new_counter_cpu,
entry->cpu_counters[i]);
if (ret) {
ERR("Failed to duplicate userspace tracer counter cpu data for application user: uid = %d, pid = %d, application name = '%s'",
entry->cpu_counters[i]);
if (ret) {
ERR("Failed to duplicate userspace tracer counter cpu data for application user: uid = %d, pid = %d, application name = '%s'",
@@
-688,7
+699,7
@@
event_notifier_error_accounting_register_app(struct ust_app *app)
app->event_notifier_group.nr_counter_cpu = entry->nr_counter_cpu_fds;
app->event_notifier_group.counter_cpu = cpu_counters;
cpu_counters = NULL;
app->event_notifier_group.nr_counter_cpu = entry->nr_counter_cpu_fds;
app->event_notifier_group.counter_cpu = cpu_counters;
cpu_counters = NULL;
- goto end;
+ goto end
_unlock
;
error_send_cpu_counter_data:
error_duplicate_cpu_counter:
error_send_cpu_counter_data:
error_duplicate_cpu_counter:
@@
-702,7
+713,7
@@
error_duplicate_cpu_counter:
break;
}
break;
}
-
ust
ctl_release_object(-1, cpu_counters[i]);
+
lttng_ust_
ctl_release_object(-1, cpu_counters[i]);
free(cpu_counters[i]);
}
free(cpu_counters[i]);
}
@@
-710,14
+721,15
@@
error_duplicate_cpu_counter:
error_allocate_cpu_counters:
error_send_counter_data:
error_allocate_cpu_counters:
error_send_counter_data:
-
ust
ctl_release_object(-1, new_counter);
+
lttng_ust_
ctl_release_object(-1, new_counter);
free(new_counter);
error_duplicate_counter:
ust_error_accounting_entry_put(entry);
error_creating_entry:
app->event_notifier_group.counter = NULL;
free(new_counter);
error_duplicate_counter:
ust_error_accounting_entry_put(entry);
error_creating_entry:
app->event_notifier_group.counter = NULL;
-end:
+end
_unlock
:
rcu_read_unlock();
rcu_read_unlock();
+end:
return status;
}
return status;
}
@@
-752,14
+764,14
@@
event_notifier_error_accounting_unregister_app(struct ust_app *app)
}
for (i = 0; i < app->event_notifier_group.nr_counter_cpu; i++) {
}
for (i = 0; i < app->event_notifier_group.nr_counter_cpu; i++) {
-
ust
ctl_release_object(app->sock,
+
lttng_ust_
ctl_release_object(app->sock,
app->event_notifier_group.counter_cpu[i]);
free(app->event_notifier_group.counter_cpu[i]);
}
free(app->event_notifier_group.counter_cpu);
app->event_notifier_group.counter_cpu[i]);
free(app->event_notifier_group.counter_cpu[i]);
}
free(app->event_notifier_group.counter_cpu);
-
ust
ctl_release_object(app->sock, app->event_notifier_group.counter);
+
lttng_ust_
ctl_release_object(app->sock, app->event_notifier_group.counter);
free(app->event_notifier_group.counter);
status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;
free(app->event_notifier_group.counter);
status = EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK;
@@
-813,7
+825,7
@@
event_notifier_error_accounting_ust_get_count(
int64_t local_value = 0;
bool overflow = false, underflow = false;
int64_t local_value = 0;
bool overflow = false, underflow = false;
- ret =
ust
ctl_counter_aggregate(uid_entry->daemon_counter,
+ ret =
lttng_ust_
ctl_counter_aggregate(uid_entry->daemon_counter,
dimension_indexes, &local_value, &overflow,
&underflow);
if (ret || local_value < 0) {
dimension_indexes, &local_value, &overflow,
&underflow);
if (ret || local_value < 0) {
@@
-883,7
+895,7
@@
enum event_notifier_error_accounting_status event_notifier_error_accounting_ust_
*/
cds_lfht_for_each_entry(error_counter_uid_ht->ht, &iter.iter,
uid_entry, node.node) {
*/
cds_lfht_for_each_entry(error_counter_uid_ht->ht, &iter.iter,
uid_entry, node.node) {
- const int ret =
ust
ctl_counter_clear(uid_entry->daemon_counter,
+ const int ret =
lttng_ust_
ctl_counter_clear(uid_entry->daemon_counter,
&dimension_index);
if (ret) {
&dimension_index);
if (ret) {
@@
-915,7
+927,7
@@
event_notifier_error_accounting_kernel_clear(
int ret;
uint64_t error_counter_index;
enum event_notifier_error_accounting_status status;
int ret;
uint64_t error_counter_index;
enum event_notifier_error_accounting_status status;
- struct lttng_kernel_counter_clear counter_clear = {};
+ struct lttng_kernel_
abi_
counter_clear counter_clear = {};
status = get_error_counter_index_for_token(&kernel_state,
lttng_trigger_get_tracer_token(trigger),
status = get_error_counter_index_for_token(&kernel_state,
lttng_trigger_get_tracer_token(trigger),
@@
-963,11
+975,11
@@
event_notifier_error_accounting_register_kernel(
{
int error_counter_fd = -1, ret;
enum event_notifier_error_accounting_status status;
{
int error_counter_fd = -1, ret;
enum event_notifier_error_accounting_status status;
- const struct lttng_kernel_counter_conf error_counter_conf = {
- .arithmetic = LTTNG_KERNEL_COUNTER_ARITHMETIC_MODULAR,
+ const struct lttng_kernel_
abi_
counter_conf error_counter_conf = {
+ .arithmetic = LTTNG_KERNEL_
ABI_
COUNTER_ARITHMETIC_MODULAR,
.bitness = sizeof(void *) == sizeof(uint32_t) ?
.bitness = sizeof(void *) == sizeof(uint32_t) ?
- LTTNG_KERNEL_COUNTER_BITNESS_32 :
- LTTNG_KERNEL_COUNTER_BITNESS_64,
+ LTTNG_KERNEL_
ABI_
COUNTER_BITNESS_32 :
+ LTTNG_KERNEL_
ABI_
COUNTER_BITNESS_64,
.global_sum_step = 0,
.number_dimensions = 1,
.dimensions[0].size = kernel_state.number_indices,
.global_sum_step = 0,
.number_dimensions = 1,
.dimensions[0].size = kernel_state.number_indices,
@@
-1069,6
+1081,9
@@
event_notifier_error_accounting_register_event_notifier(
state = &kernel_state;
break;
case LTTNG_DOMAIN_UST:
state = &kernel_state;
break;
case LTTNG_DOMAIN_UST:
+ case LTTNG_DOMAIN_PYTHON:
+ case LTTNG_DOMAIN_JUL:
+ case LTTNG_DOMAIN_LOG4J:
state = &ust_state;
break;
default:
state = &ust_state;
break;
default:
@@
-1117,6
+1132,9
@@
event_notifier_error_accounting_register_event_notifier(
#ifdef HAVE_LIBLTTNG_UST_CTL
switch (lttng_trigger_get_underlying_domain_type_restriction(trigger)) {
case LTTNG_DOMAIN_UST:
#ifdef HAVE_LIBLTTNG_UST_CTL
switch (lttng_trigger_get_underlying_domain_type_restriction(trigger)) {
case LTTNG_DOMAIN_UST:
+ case LTTNG_DOMAIN_PYTHON:
+ case LTTNG_DOMAIN_JUL:
+ case LTTNG_DOMAIN_LOG4J:
pthread_mutex_lock(&the_event_notifier_counter.lock);
the_event_notifier_counter.count++;
if (the_event_notifier_counter.count == 1) {
pthread_mutex_lock(&the_event_notifier_counter.lock);
the_event_notifier_counter.count++;
if (the_event_notifier_counter.count == 1) {
@@
-1145,7
+1163,7
@@
enum event_notifier_error_accounting_status
event_notifier_error_accounting_kernel_get_count(
const struct lttng_trigger *trigger, uint64_t *count)
{
event_notifier_error_accounting_kernel_get_count(
const struct lttng_trigger *trigger, uint64_t *count)
{
- struct lttng_kernel_counter_aggregate counter_aggregate = {};
+ struct lttng_kernel_
abi_
counter_aggregate counter_aggregate = {};
enum event_notifier_error_accounting_status status;
uint64_t error_counter_index;
int ret;
enum event_notifier_error_accounting_status status;
uint64_t error_counter_index;
int ret;
@@
-1206,6
+1224,9
@@
event_notifier_error_accounting_get_count(
return event_notifier_error_accounting_kernel_get_count(
trigger, count);
case LTTNG_DOMAIN_UST:
return event_notifier_error_accounting_kernel_get_count(
trigger, count);
case LTTNG_DOMAIN_UST:
+ case LTTNG_DOMAIN_PYTHON:
+ case LTTNG_DOMAIN_JUL:
+ case LTTNG_DOMAIN_LOG4J:
#ifdef HAVE_LIBLTTNG_UST_CTL
return event_notifier_error_accounting_ust_get_count(trigger,
count);
#ifdef HAVE_LIBLTTNG_UST_CTL
return event_notifier_error_accounting_ust_get_count(trigger,
count);
@@
-1226,6
+1247,9
@@
event_notifier_error_accounting_clear(const struct lttng_trigger *trigger)
case LTTNG_DOMAIN_KERNEL:
return event_notifier_error_accounting_kernel_clear(trigger);
case LTTNG_DOMAIN_UST:
case LTTNG_DOMAIN_KERNEL:
return event_notifier_error_accounting_kernel_clear(trigger);
case LTTNG_DOMAIN_UST:
+ case LTTNG_DOMAIN_PYTHON:
+ case LTTNG_DOMAIN_JUL:
+ case LTTNG_DOMAIN_LOG4J:
#ifdef HAVE_LIBLTTNG_UST_CTL
return event_notifier_error_accounting_ust_clear(trigger);
#else
#ifdef HAVE_LIBLTTNG_UST_CTL
return event_notifier_error_accounting_ust_clear(trigger);
#else
@@
-1269,6
+1293,9
@@
void event_notifier_error_accounting_unregister_event_notifier(
break;
#ifdef HAVE_LIBLTTNG_UST_CTL
case LTTNG_DOMAIN_UST:
break;
#ifdef HAVE_LIBLTTNG_UST_CTL
case LTTNG_DOMAIN_UST:
+ case LTTNG_DOMAIN_PYTHON:
+ case LTTNG_DOMAIN_JUL:
+ case LTTNG_DOMAIN_LOG4J:
state = &ust_state;
pthread_mutex_lock(&the_event_notifier_counter.lock);
state = &ust_state;
pthread_mutex_lock(&the_event_notifier_counter.lock);
This page took
0.031763 seconds
and
4
git commands to generate.