diff options
author | Siri Hansen <[email protected]> | 2013-03-14 10:57:39 +0100 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2013-03-14 10:57:39 +0100 |
commit | e2ee1f79a7d0ffe02eab4da90d655e77893d1666 (patch) | |
tree | aff42174e9798e056e9f34c2c57b77649a0b9a9d /lib/sasl | |
parent | e5df75bfc94662ffe9c36e0b1643cef0104586e0 (diff) | |
parent | 0541bbab72df88b91d5725ad209aef1a951a4448 (diff) | |
download | otp-e2ee1f79a7d0ffe02eab4da90d655e77893d1666.tar.gz otp-e2ee1f79a7d0ffe02eab4da90d655e77893d1666.tar.bz2 otp-e2ee1f79a7d0ffe02eab4da90d655e77893d1666.zip |
Merge branch 'siri/cuddle-with-tests' into maint
* siri/cuddle-with-tests:
[sasl] Fix tests that compare execution time
[jinterface] Kill process between tests to avoid consequential error
[jinterface] Make tests handle space in path on windows
[common_test] Extend timers for slave nodes in ct_cover_SUITE
[test_server] Clean up unused code in test_server_SUITE
[reltool] Increase timetrap timeout for reltool_server_SUTIE to 10 minutes
[test_server] Fix encoding of HTML file references to work on windows
[test_server] Use simpler tc name in unicode test to make it work on windows
Diffstat (limited to 'lib/sasl')
-rw-r--r-- | lib/sasl/test/release_handler_SUITE.erl | 60 |
1 files changed, 49 insertions, 11 deletions
diff --git a/lib/sasl/test/release_handler_SUITE.erl b/lib/sasl/test/release_handler_SUITE.erl index 82b7a738bb..97ba70c9bd 100644 --- a/lib/sasl/test/release_handler_SUITE.erl +++ b/lib/sasl/test/release_handler_SUITE.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2011-2012. All Rights Reserved. +%% Copyright Ericsson AB 2011-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -1094,9 +1094,11 @@ otp_9395_update_many_mods(Conf) when is_list(Conf) -> [RelVsn2, filename:join(Rel2Dir, "sys.config")]), %% First, install release directly and check how much time it takes + rpc:call(Node,erlang,system_flag,[scheduler_wall_time,true]), {TInst0,{ok, _, []}} = timer:tc(rpc,call,[Node, release_handler, install_release, [RelVsn2]]), - ct:log("install_release: ~.2f",[TInst0/1000000]), + SWT0 = rpc:call(Node,erlang,statistics,[scheduler_wall_time]), +% ct:log("install_release: ~.2f",[TInst0/1000000]), %% Restore to old release, spawn processes again and load to get old code {_,RelVsn1} = init:script_id(), @@ -1113,15 +1115,32 @@ otp_9395_update_many_mods(Conf) when is_list(Conf) -> {TCheck,{ok, _RelVsn1, []}} = timer:tc(rpc,call,[Node, release_handler, check_install_release, [RelVsn2,[purge]]]), - ct:log("check_install_release with purge: ~.2f",[TCheck/1000000]), +% ct:log("check_install_release with purge: ~.2f",[TCheck/1000000]), %% Finally install release after check and purge, and check that %% this install was faster than the first. + rpc:call(Node,erlang,system_flag,[scheduler_wall_time,false]), + rpc:call(Node,erlang,system_flag,[scheduler_wall_time,true]), {TInst2,{ok, _RelVsn1, []}} = timer:tc(rpc,call,[Node, release_handler, install_release, [RelVsn2]]), - ct:log("install_release: ~.2f",[TInst2/1000000]), - - true = (TInst2 < TInst0), + SWT2 = rpc:call(Node,erlang,statistics,[scheduler_wall_time]), +% ct:log("install_release: ~.2f",[TInst2/1000000]), + + %% Calculate and print real time and CPU utilization + SumFun = fun({_,A,T},{AAcc,TAcc}) -> {A+AAcc,T+TAcc} end, + {SumA0,SumT0} = lists:foldl(SumFun,{0,0},SWT0), + {SumA2,SumT2} = lists:foldl(SumFun,{0,0},SWT2), + TI0=TInst0/1000000, + TI2=TInst2/1000000, + CPU0=SumA0/SumT0, + CPU2=SumA2/SumT2, + X0 = TI0*CPU0, + X2 = TI2*CPU2, + ct:log("First run: T=~.2fsec, CPU=~.2f, T*CPU=~.2f~n" + "Second run: T=~.2fsec, CPU=~.2f, T*CPU=~.2f~n", + [TI0, CPU0, X0, TI2, CPU2, X2]), + + true = (X2 =< X0), % disregarding wait time for file access etc. ok. @@ -1172,9 +1191,11 @@ otp_9395_rm_many_mods(Conf) when is_list(Conf) -> [RelVsn2, filename:join(Rel2Dir, "sys.config")]), %% First, install release directly and check how much time it takes + rpc:call(Node,erlang,system_flag,[scheduler_wall_time,true]), {TInst0,{ok, _, []}} = timer:tc(rpc,call,[Node, release_handler, install_release, [RelVsn2]]), - ct:log("install_release: ~.2f",[TInst0/1000000]), + SWT0 = rpc:call(Node,erlang,statistics,[scheduler_wall_time]), +% ct:log("install_release: ~.2f",[TInst0/1000000]), %% Restore to old release, spawn processes again and load to get old code {_,RelVsn1} = init:script_id(), @@ -1191,15 +1212,32 @@ otp_9395_rm_many_mods(Conf) when is_list(Conf) -> {TCheck,{ok, _RelVsn1, []}} = timer:tc(rpc,call,[Node, release_handler, check_install_release, [RelVsn2,[purge]]]), - ct:log("check_install_release with purge: ~.2f",[TCheck/1000000]), +% ct:log("check_install_release with purge: ~.2f",[TCheck/1000000]), %% Finally install release after check and purge, and check that %% this install was faster than the first. + rpc:call(Node,erlang,system_flag,[scheduler_wall_time,false]), + rpc:call(Node,erlang,system_flag,[scheduler_wall_time,true]), {TInst2,{ok, _RelVsn1, []}} = timer:tc(rpc,call,[Node, release_handler, install_release, [RelVsn2]]), - ct:log("install_release: ~.2f",[TInst2/1000000]), - - true = (TInst2 =< TInst0), + SWT2 = rpc:call(Node,erlang,statistics,[scheduler_wall_time]), +% ct:log("install_release: ~.2f",[TInst2/1000000]), + + %% Calculate and print real time and CPU utilization + SumFun = fun({_,A,T},{AAcc,TAcc}) -> {A+AAcc,T+TAcc} end, + {SumA0,SumT0} = lists:foldl(SumFun,{0,0},SWT0), + {SumA2,SumT2} = lists:foldl(SumFun,{0,0},SWT2), + TI0=TInst0/1000000, + TI2=TInst2/1000000, + CPU0=SumA0/SumT0, + CPU2=SumA2/SumT2, + X0 = TI0*CPU0, + X2 = TI2*CPU2, + ct:log("First run: T=~.2fsec, CPU=~.2f, T*CPU=~.2f~n" + "Second run: T=~.2fsec, CPU=~.2f, T*CPU=~.2f~n", + [TI0, CPU0, X0, TI2, CPU2, X2]), + + true = (X2 =< X0), % disregarding wait time for file access etc. ok. |