diff options
author | Björn-Egil Dahlberg <[email protected]> | 2012-01-03 11:16:34 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2012-01-03 11:16:34 +0100 |
commit | 0128abfb1c802bf09d3950d0f32d7729ed45ac4b (patch) | |
tree | 084690ab50bc162630c7d6b006af1f7ffeb6d191 | |
parent | 2f5b8922887dd970d81c72bc9cd8478b97de87db (diff) | |
download | otp-0128abfb1c802bf09d3950d0f32d7729ed45ac4b.tar.gz otp-0128abfb1c802bf09d3950d0f32d7729ed45ac4b.tar.bz2 otp-0128abfb1c802bf09d3950d0f32d7729ed45ac4b.zip |
test: system_profile profiler pid is not profiled
-rw-r--r-- | erts/emulator/test/system_profile_SUITE.erl | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/erts/emulator/test/system_profile_SUITE.erl b/erts/emulator/test/system_profile_SUITE.erl index 199cd7c831..659e43f81d 100644 --- a/erts/emulator/test/system_profile_SUITE.erl +++ b/erts/emulator/test/system_profile_SUITE.erl @@ -27,6 +27,7 @@ system_profile_on_and_off/1, runnable_procs/1, runnable_ports/1, + dont_profile_profiler/1, scheduler/1 ]). @@ -51,7 +52,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}]. all() -> [system_profile_on_and_off, runnable_procs, - runnable_ports, scheduler]. + runnable_ports, scheduler, dont_profile_profiler]. groups() -> []. @@ -168,6 +169,29 @@ scheduler(Config) when is_list(Config) -> ok = check_multi_scheduling_block(Nodes) end. +% the profiler pid should not be profiled +dont_profile_profiler(suite) -> + []; +dont_profile_profiler(doc) -> + ["Ensure system profiler process is not profiled."]; +dont_profile_profiler(Config) when is_list(Config) -> + Pid = start_profiler_process(), + + Nodes = 10, + Laps = 10, + Master = ring(Nodes), + undefined = erlang:system_profile(Pid, [runnable_procs]), + % loop a message + ok = ring_message(Master, message, Laps), + erlang:system_profile(undefined, []), + kill_em_all = kill_ring(Master), + Events = get_profiler_events(), + false = has_profiler_pid_event(Events, Pid), + + exit(Pid,kill), + ok. + + %%% Check scheduler profiling check_multi_scheduling_block(Nodes) -> @@ -447,6 +471,12 @@ has_runnable_event(Events) -> end end, Events). +has_profiler_pid_event([], _) -> false; +has_profiler_pid_event([{profile, Pid, _Activity, _MFA, _TS}|Events], Pid) -> true; +has_profiler_pid_event([_|Events], Pid) -> + has_profiler_pid_event(Events, Pid). + + wait(Time) -> receive after Time -> ok end. %%% |