Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
92e842a3
Commit
92e842a3
authored
3 years ago
by
Olivier Dion
Committed by
Sébastien Blin
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
client/ring_signal: Add tracepoints
Change-Id: I522edb40e114f03cdf6605f09cc40cdb0bd886b2
parent
475f04e1
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/client/ring_signal.h
+15
-3
15 additions, 3 deletions
src/client/ring_signal.h
src/jami/jami.h
+21
-6
21 additions, 6 deletions
src/jami/jami.h
src/jami/tracepoint-def.h
+9
-0
9 additions, 0 deletions
src/jami/tracepoint-def.h
with
45 additions
and
9 deletions
src/client/ring_signal.h
+
15
−
3
View file @
92e842a3
...
...
@@ -36,6 +36,8 @@
#include
"jami.h"
#include
"logger.h"
#include
"trace-tools.h"
#include
"tracepoint.h"
#ifdef __APPLE__
#include
<TargetConditionals.h>
...
...
@@ -56,19 +58,29 @@ extern SignalHandlerMap& getSignalHandlers();
* Find related user given callback and call it with given
* arguments.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
template
<
typename
Ts
,
typename
...
Args
>
static
void
emitSignal
(
Args
...
args
)
void
emitSignal
(
Args
...
args
)
{
jami_tracepoint_if_enabled
(
emit_signal
,
demangle
<
Ts
>
().
c_str
());
const
auto
&
handlers
=
getSignalHandlers
();
if
(
auto
cb
=
*
DRing
::
CallbackWrapper
<
typename
Ts
::
cb_type
>
(
handlers
.
at
(
Ts
::
name
)))
{
if
(
auto
wrap
=
DRing
::
CallbackWrapper
<
typename
Ts
::
cb_type
>
(
handlers
.
at
(
Ts
::
name
)))
{
try
{
auto
cb
=
*
wrap
;
jami_tracepoint
(
emit_signal_begin_callback
,
wrap
.
file_
,
wrap
.
linum_
);
cb
(
args
...);
jami_tracepoint
(
emit_signal_end_callback
);
}
catch
(
std
::
exception
&
e
)
{
JAMI_ERR
(
"Exception during emit signal %s:
\n
%s"
,
Ts
::
name
,
e
.
what
());
}
}
jami_tracepoint
(
emit_signal_end
);
}
#pragma GCC diagnostic pop
template
<
typename
Ts
>
std
::
pair
<
std
::
string
,
std
::
shared_ptr
<
DRing
::
CallbackWrapper
<
typename
Ts
::
cb_type
>>>
...
...
This diff is collapsed.
Click to expand it.
src/jami/jami.h
+
21
−
6
View file @
92e842a3
...
...
@@ -30,6 +30,8 @@
#include
<memory>
#include
<type_traits>
#include
"trace-tools.h"
namespace
DRing
{
/* flags for initialization */
...
...
@@ -114,13 +116,18 @@ private:
TFunc
cb_
;
// The user-callback
public:
const
char
*
file_
;
uint32_t
linum_
;
// Empty wrapper: no callback associated.
// Used to initialize internal callback arrays.
CallbackWrapper
()
noexcept
{}
// Create and initialize a wrapper to given callback.
CallbackWrapper
(
TFunc
&&
func
)
noexcept
:
cb_
(
std
::
forward
<
TFunc
>
(
func
))
CallbackWrapper
(
TFunc
&&
func
,
const
char
*
filename
,
uint32_t
linum
)
noexcept
:
cb_
(
std
::
forward
<
TFunc
>
(
func
)),
file_
(
filename
),
linum_
(
linum
)
{}
// Create and initialize a wrapper from a generic CallbackWrapperBase
...
...
@@ -128,8 +135,13 @@ public:
// Note: the given callback is copied into internal storage.
CallbackWrapper
(
const
std
::
shared_ptr
<
CallbackWrapperBase
>&
p
)
noexcept
{
if
(
p
)
cb_
=
((
CallbackWrapper
<
TProto
>*
)
p
.
get
())
->
cb_
;
if
(
p
)
{
auto
other
=
(
CallbackWrapper
<
TProto
>*
)
p
.
get
();
cb_
=
other
->
cb_
;
file_
=
other
->
file_
;
linum_
=
other
->
linum_
;
}
}
// Return user-callback reference.
...
...
@@ -149,11 +161,14 @@ public:
*/
template
<
typename
Ts
>
std
::
pair
<
std
::
string
,
std
::
shared_ptr
<
CallbackWrapperBase
>>
exportable_callback
(
std
::
function
<
typename
Ts
::
cb_type
>&&
func
)
exportable_callback
(
std
::
function
<
typename
Ts
::
cb_type
>&&
func
,
const
char
*
file
=
CURRENT_FILENAME
(),
uint32_t
linum
=
CURRENT_LINE
())
{
return
std
::
make_pair
((
const
std
::
string
&
)
Ts
::
name
,
std
::
make_shared
<
CallbackWrapper
<
typename
Ts
::
cb_type
>>
(
std
::
forward
<
std
::
function
<
typename
Ts
::
cb_type
>>
(
func
)));
std
::
forward
<
std
::
function
<
typename
Ts
::
cb_type
>>
(
func
),
file
,
linum
));
}
DRING_PUBLIC
void
registerSignalHandlers
(
...
...
This diff is collapsed.
Click to expand it.
src/jami/tracepoint-def.h
+
9
−
0
View file @
92e842a3
...
...
@@ -112,6 +112,15 @@ LTTNG_UST_TRACEPOINT_EVENT(
)
)
LTTNG_UST_TRACEPOINT_EVENT
(
jami
,
emit_signal_end
,
LTTNG_UST_TP_ARGS
(
),
LTTNG_UST_TP_FIELDS
(
)
)
LTTNG_UST_TRACEPOINT_EVENT
(
jami
,
emit_signal_begin_callback
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment