note description: "Data container to store the results of an aspect of a profiling run. Results always come in pairs: sender and receiver measurements" author: "Comerge AG, DR" date: "$Date$" revision: "$Revision$" class AP_PROFILING_RESULT inherit PROFILING_UTILS create make feature -- Creation make (a_sender_stamps, a_receiver_stamps: DS_ARRAYED_LIST [INTEGER_64]; an_id: STRING) is -- create with the given timestamps measured in milliseconds require same_length: (a_sender_stamps /= Void and a_receiver_stamps /= VOid) and then (a_sender_stamps.count = a_receiver_stamps.count) do id := an_id compute_transmission_times (a_sender_stamps, a_receiver_stamps) end feature -- Access id: STRING -- unique identifier for the result, e.g. the layer the results were taken (ems, app, ...) request_transmission_times: DS_ARRAYED_LIST [INTEGER_64] -- transmission times for the request (sender -> receiver) response_transmission_times: DS_ARRAYED_LIST [INTEGER_64] -- transmission times for the response (receiver -> sender) mean_request_transmission_time: REAL_64 is -- do Result := compute_mean (request_transmission_times.to_array) end mean_response_transmission_time: REAL_64 IS -- do Result := compute_mean (response_transmission_times.to_array) end feature {NONE} -- Implementation compute_transmission_times (a_sender_stamps, a_receiver_stamps: DS_ARRAYED_LIST [INTEGER_64]) is -- local i: INTEGER delta, min, max: INTEGER_64 do create request_transmission_times.make_default create response_transmission_times.make_default -- compute transmission times from i := 1 until i > a_sender_stamps.count loop if (i \\ 2 = 0) then -- receiver -> sender delta := a_sender_stamps.item (i) - a_receiver_stamps.item (i) response_transmission_times.force_last (delta) else -- sender -> receiver delta := a_receiver_stamps.item (i) - a_sender_stamps.item (i) request_transmission_times.force_last (delta) end i := i + 1 end -- remove largest and smallest values if request_transmission_times.count > 2 then min := remove_min(request_transmission_times) max := remove_max(request_transmission_times) print("dropped min/max values from " + id + " request transmission times: " + min.out + ", " + max.out + "%N") end if response_transmission_times.count > 2 then min := remove_min(response_transmission_times) max := remove_max(response_transmission_times) print("dropped min/max values from " + id + " response transmission times: " + min.out + ", " + max.out + "%N") end end end