Wireshark-dev: Re: [Wireshark-dev] Tips regarding measuring function execution times
From: Roland Knall <rknall@xxxxxxxxx>
Date: Mon, 16 Oct 2017 06:38:11 +0200
Keep in mind, that printf is by far one of the slowest functions. Additionally it slows also down the output as well. I'd recommend writing the times into a buffer and dumping them in intervalls, very much like the tap's work, otherwise what you see might not be what is happening on the network.

cheers

On Sun, Oct 15, 2017 at 11:15 PM, Paul Offord <Paul.Offord@xxxxxxxxxxxx> wrote:

Thanks to all for the tips.  I’ll give it a go.

 

From: Wireshark-dev [mailto:wireshark-dev-bounces@wireshark.org] On Behalf Of Pascal Quantin
Sent: 15 October 2017 21:50
To: Developer support list for Wireshark <wireshark-dev@xxxxxxxxxxxxx>
Subject: Re: [Wireshark-dev] Tips regarding measuring function execution times

 

 

 

2017-10-15 22:40 GMT+02:00 João Valverde <joao.valverde@tecnico.ulisboa.pt>:



On 15-10-2017 21:32, Peter Wu wrote:

On Sat, Oct 14, 2017 at 02:18:39PM +0000, Paul Offord wrote:

I'm investigating a performance problem with the TRANSUM dissector.  I'd like to measure the accumulated time taken to execute a function in a Release build.  My basic idea is to do something like this:

guint32 execute_time_us;
.
.
start_stopwatch(&execute_time_us);
function_call_to_be_measured();
pause_stopwatch(&execute_time_us);

.
.
.

stop_and_output_stopwatch(&execute_time_us);

Is there a standard way to do this in Wireshark?  How can I output the accumulated time on, say, the Status Line?


Not sure about the Status line question, but you can measure elapsed
microseconds with something like:

     guint64 start_time, end_time;

     start_time = g_get_monotonic_time();
     // ...
     end_time = g_get_monotonic_time();
     // ...
     g_print("elapsed us: %" G_GUINT64_FORMAT, end_time - start_time);

https://developer.gnome.org/glib/stable/glib-Date-and-Time-Functions.html#g-get-monotonic-time


I think console output doesn't work on Windows for graphical applications, or something like that. There isn't a better standard mechanism for debug output in Wireshark, that I know of.

 

You can make it appear with Edit -> Preferences -> Advanced -> change gui.console_open option to ALWAYS.

 

Pascal.


______________________________________________________________________

This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.

Any views or opinions expressed are solely those of the author and do not necessarily represent those of Advance Seven Ltd. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.

Advance Seven Ltd. Registered in England & Wales numbered 2373877 at Endeavour House, Coopers End Lane, Stansted, Essex CM24 1SJ

______________________________________________________________________
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________

___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev@xxxxxxxxxxxxx>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request@wireshark.org?subject=unsubscribe