diff options
author | Anders Broman <anders.broman@ericsson.com> | 2009-08-28 05:19:52 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2009-08-28 05:19:52 +0000 |
commit | 2cd2eecd0a470bb326c658157d32bfe614698ad0 (patch) | |
tree | 61e3db1ee1afe7d1c8f3f01c12208caa28c7c210 /file.c | |
parent | 5cba22a89b913c580c9ca20dd0622ee4fb10b12b (diff) |
Compute the loading time and show it in the main status bar.
(Modified code from Didier Gautheron).
svn path=/trunk/; revision=29592
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 21 |
1 files changed, 21 insertions, 0 deletions
@@ -81,6 +81,7 @@ gboolean auto_scroll_live; static nstime_t first_ts; static nstime_t prev_dis_ts; static guint32 cum_bytes = 0; +static gulong computed_elapsed; static void cf_reset_state(capture_file *cf); @@ -410,6 +411,23 @@ void outofmemory_cb(gpointer dialog _U_, gint btn _U_, gpointer data _U_) main_window_exit(); } +gulong +cf_get_computed_elapsed(void){ + return computed_elapsed; +} +static void compute_elapsed(GTimeVal *start_time) +{ + gdouble delta_time; + GTimeVal time_now; + + g_get_current_time(&time_now); + + delta_time = (time_now.tv_sec - start_time->tv_sec) * 1e6 + + time_now.tv_usec - start_time->tv_usec; + + computed_elapsed = (gulong) (delta_time / 1000); /* ms*/ +} + cf_read_status_t cf_read(capture_file *cf) { @@ -596,6 +614,9 @@ cf_read(capture_file *cf) * don't need after the sequential run-through of the packets. */ postseq_cleanup_all_protocols(); + /* compute the time it took to load the file */ + compute_elapsed(&start_time); + /* Set the file encapsulation type now; we don't know what it is until we've looked at all the packets, as we don't know until then whether there's more than one type (and thus whether it's |