2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #include <urcu/list.h>
32 * find_session_ust_trace_by_pid
34 * Iterate over the session ust_traces and
35 * return a pointer or NULL if not found.
37 struct ltt_ust_trace
*find_session_ust_trace_by_pid(struct ltt_session
*session
, pid_t pid
)
39 struct ltt_ust_trace
*iter
;
41 cds_list_for_each_entry(iter
, &session
->ust_traces
, list
) {
42 if (iter
->pid
== pid
) {
52 * get_trace_count_per_session
54 * Return the total count of traces (ust and kernel)
55 * for the specified session.
57 int get_trace_count_per_session(struct ltt_session
*session
)
59 return session
->ust_trace_count
+ session
->kern_trace_count
;
63 * get_traces_per_session
65 * Fill the lttng_trace array of all the
66 * available trace of the session.
68 void get_traces_per_session(struct ltt_session
*session
, struct lttng_trace
*traces
)
71 struct ltt_ust_trace
*ust_iter
;
72 struct ltt_kernel_trace
*kern_iter
;
73 struct lttng_trace trace
;
75 DBG("Getting userspace traces for session %s", session
->name
);
77 /* Getting userspace traces */
78 cds_list_for_each_entry(ust_iter
, &session
->ust_traces
, list
) {
79 trace
.type
= USERSPACE
;
80 trace
.pid
= ust_iter
->pid
;
81 strncpy(trace
.name
, ust_iter
->name
, sizeof(trace
.name
));
82 trace
.name
[sizeof(trace
.name
) - 1] = '\0';
83 memcpy(&traces
[i
], &trace
, sizeof(trace
));
84 memset(&trace
, 0, sizeof(trace
));
88 DBG("Getting kernel traces for session %s", session
->name
);
90 /* Getting kernel traces */
91 cds_list_for_each_entry(kern_iter
, &session
->kernel_traces
, list
) {
93 strncpy(trace
.name
, kern_iter
->name
, sizeof(trace
.name
));
94 trace
.name
[sizeof(trace
.name
) - 1] = '\0';
95 memcpy(&traces
[i
], &trace
, sizeof(trace
));
96 memset(&trace
, 0, sizeof(trace
));
This page took 0.033397 seconds and 5 git commands to generate.