aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--erts/emulator/beam/erl_trace.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/erts/emulator/beam/erl_trace.c b/erts/emulator/beam/erl_trace.c
index 70c3e7612f..b487dbf054 100644
--- a/erts/emulator/beam/erl_trace.c
+++ b/erts/emulator/beam/erl_trace.c
@@ -544,7 +544,7 @@ send_to_port(Process *c_p, Eterm message,
*/
static void
-profile_send(Eterm profiler, Eterm message) {
+profile_send(Eterm message) {
Uint sz = 0;
ErlHeapFragment *bp = NULL;
Uint *hp = NULL;
@@ -552,6 +552,8 @@ profile_send(Eterm profiler, Eterm message) {
Process *profile_p = NULL;
ErlOffHeap *off_heap = NULL;
+ Eterm profiler = erts_get_system_profile();
+
if (is_internal_port(profiler)) {
Port *profiler_port = NULL;
@@ -2581,7 +2583,6 @@ profile_scheduler(Eterm scheduler_id, Eterm state) {
Uint Ms, s, us;
#ifndef ERTS_SMP
- Eterm profiler;
#define LOCAL_HEAP_SIZE (4 + 7)
DeclareTmpHeapNoproc(local_heap,LOCAL_HEAP_SIZE);
UseTmpHeapNoproc(LOCAL_HEAP_SIZE);
@@ -2616,8 +2617,7 @@ profile_scheduler(Eterm scheduler_id, Eterm state) {
make_small(active_sched), timestamp); hp += 7;
#ifndef ERTS_SMP
- profiler = erts_get_system_profile();
- profile_send(profiler, msg);
+ profile_send(msg);
UnUseTmpHeapNoproc(LOCAL_HEAP_SIZE);
#undef LOCAL_HEAP_SIZE
#else
@@ -2632,7 +2632,6 @@ profile_scheduler_q(Eterm scheduler_id, Eterm state, Eterm no_schedulers, Uint M
Eterm *hp, msg, timestamp;
#ifndef ERTS_SMP
- Eterm profiler;
#define LOCAL_HEAP_SIZE (4 + 7)
DeclareTmpHeapNoproc(local_heap,LOCAL_HEAP_SIZE);
UseTmpHeapNoproc(LOCAL_HEAP_SIZE);
@@ -2653,8 +2652,7 @@ profile_scheduler_q(Eterm scheduler_id, Eterm state, Eterm no_schedulers, Uint M
timestamp = TUPLE3(hp, make_small(Ms), make_small(s), make_small(us)); hp += 4;
msg = TUPLE6(hp, am_profile, am_scheduler, scheduler_id, state, no_schedulers, timestamp); hp += 7;
#ifndef ERTS_SMP
- profiler = erts_get_system_profile();
- profile_send(profiler, msg);
+ profile_send(msg);
UnUseTmpHeapNoproc(LOCAL_HEAP_SIZE);
#undef LOCAL_HEAP_SIZE
#else
@@ -2897,7 +2895,6 @@ profile_runnable_port(Port *p, Eterm status) {
Eterm count = make_small(0);
#ifndef ERTS_SMP
- Eterm profiler;
#define LOCAL_HEAP_SIZE (4 + 6)
DeclareTmpHeapNoproc(local_heap,LOCAL_HEAP_SIZE);
@@ -2922,8 +2919,7 @@ profile_runnable_port(Port *p, Eterm status) {
msg = TUPLE5(hp, am_profile, p->id, status, count, timestamp); hp += 6;
#ifndef ERTS_SMP
- profiler = erts_get_system_profile();
- profile_send(profiler, msg);
+ profile_send(msg);
UnUseTmpHeapNoproc(LOCAL_HEAP_SIZE);
#undef LOCAL_HEAP_SIZE
#else
@@ -2938,7 +2934,6 @@ profile_runnable_proc(Process *p, Eterm status){
Uint Ms, s, us;
Eterm *hp, msg, timestamp;
Eterm where = am_undefined;
- Eterm profiler;
#ifndef ERTS_SMP
#define LOCAL_HEAP_SIZE (4 + 6 + 4)
@@ -2951,12 +2946,6 @@ profile_runnable_proc(Process *p, Eterm status){
ErlHeapFragment *bp;
Uint hsz = 4 + 6 + 4;
#endif
- profiler = erts_get_system_profile();
-
- /* Do not profile profiler pid */
- if (profiler == p->id) {
- return;
- }
if (!p->current) {
p->current = find_function_from_pc(p->i);
@@ -2983,7 +2972,7 @@ profile_runnable_proc(Process *p, Eterm status){
timestamp = TUPLE3(hp, make_small(Ms), make_small(s), make_small(us)); hp += 4;
msg = TUPLE5(hp, am_profile, p->id, status, where, timestamp); hp += 6;
#ifndef ERTS_SMP
- profile_send(profiler, msg);
+ profile_send(msg);
UnUseTmpHeapNoproc(LOCAL_HEAP_SIZE);
#undef LOCAL_HEAP_SIZE
#else