return cf->computed_elapsed;
}
-/*
- * GLIB_CHECK_VERSION(2,28,0) adds g_get_real_time which could minimize or
- * replace this
- */
-static void compute_elapsed(capture_file *cf, GTimeVal *start_time)
+static void compute_elapsed(capture_file *cf, gint64 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;
+ gint64 delta_time = g_get_monotonic_time() - start_time;
cf->computed_elapsed = (gulong) (delta_time / 1000); /* ms */
}
progdlg_t *volatile progbar = NULL;
GTimer *prog_timer = g_timer_new();
gint64 size;
- GTimeVal start_time;
+ gint64 start_time;
epan_dissect_t edt;
wtap_rec rec;
Buffer buf;
packet_list_freeze();
cf->stop_flag = FALSE;
- g_get_current_time(&start_time);
+ start_time = g_get_monotonic_time();
epan_dissect_init(&edt, cf->epan, create_proto_tree, FALSE);
progbar_val = calc_progbar_val(cf, size, file_pos, status_str, sizeof(status_str));
if (reloading)
progbar = delayed_create_progress_dlg(cf->window, "Reloading", name_ptr,
- TRUE, &cf->stop_flag, &start_time, progbar_val);
+ TRUE, &cf->stop_flag, progbar_val);
else
progbar = delayed_create_progress_dlg(cf->window, "Loading", name_ptr,
- TRUE, &cf->stop_flag, &start_time, progbar_val);
+ TRUE, &cf->stop_flag, progbar_val);
}
/*
progbar_val = calc_progbar_val(cf, size, file_pos, status_str, sizeof(status_str));
/* update the packet bar content on the first run or frequently on very large files */
update_progress_dlg(progbar, progbar_val, status_str);
- compute_elapsed(cf, &start_time);
+ compute_elapsed(cf, start_time);
packets_bar_update();
g_timer_start(prog_timer);
}
postseq_cleanup_all_protocols();
/* compute the time it took to load the file */
- compute_elapsed(cf, &start_time);
+ compute_elapsed(cf, 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
typedef struct _callback_data_t {
gpointer pd_window;
gint64 f_len;
- GTimeVal start_time;
progdlg_t *progbar;
GTimer *prog_timer;
gboolean stop_flag;
cb_data->prog_timer = g_timer_new();
g_timer_start(cb_data->prog_timer);
-
- g_get_current_time(&cb_data->start_time);
break;
case MERGE_EVENT_RECORD_WAS_READ:
time in order to get to the next progress bar step). */
if (cb_data->progbar == NULL) {
cb_data->progbar = delayed_create_progress_dlg(cb_data->pd_window, "Merging", "files",
- FALSE, &cb_data->stop_flag, &cb_data->start_time, 0.0f);
+ FALSE, &cb_data->stop_flag, 0.0f);
}
/*
const char *filter_old = cf->dfilter ? cf->dfilter : "";
dfilter_t *dfcode;
gchar *err_msg;
- GTimeVal start_time;
/* if new filter equals old one, do nothing unless told to do so */
if (!force && strcmp(filter_new, filter_old) == 0) {
/* We have a valid filter. Replace the current filter. */
g_free(cf->dfilter);
cf->dfilter = dftext;
- g_get_current_time(&start_time);
/* Now rescan the packet list, applying the new filter, but not
int selected_frame_num, preceding_frame_num, following_frame_num, prev_frame_num;
gboolean selected_frame_seen;
float progbar_val;
- GTimeVal start_time;
+ gint64 start_time;
gchar status_str[100];
epan_dissect_t edt;
dfilter_t *dfcode;
progbar_val = 0.0f;
cf->stop_flag = FALSE;
- g_get_current_time(&start_time);
+ start_time = g_get_monotonic_time();
/* no previous row yet */
prev_frame_num = -1;
if (progbar == NULL)
progbar = delayed_create_progress_dlg(cf->window, action, action_item, TRUE,
&cf->stop_flag,
- &start_time,
progbar_val);
/*
packet_list_recreate_visible_rows();
/* Compute the time it took to filter the file */
- compute_elapsed(cf, &start_time);
+ compute_elapsed(cf, start_time);
packet_list_thaw();
GTimer *prog_timer = g_timer_new();
int progbar_count;
float progbar_val;
- GTimeVal progbar_start_time;
gchar progbar_status_str[100];
range_process_e process_this;
cf->read_lock = TRUE;
cf->stop_flag = FALSE;
- g_get_current_time(&progbar_start_time);
if (range != NULL)
packet_range_process_init(range);
progbar = delayed_create_progress_dlg(cf->window, string1, string2,
terminate_is_stop,
&cf->stop_flag,
- &progbar_start_time,
progbar_val);
/*
int count;
gboolean succeeded;
float progbar_val;
- GTimeVal start_time;
gchar status_str[100];
const char *title;
match_result result;
progbar_val = 0.0f;
cf->stop_flag = FALSE;
- g_get_current_time(&start_time);
title = cf->sfilter?cf->sfilter:"";
for (;;) {
time in order to get to the next progress bar step). */
if (progbar == NULL)
progbar = delayed_create_progress_dlg(cf->window, "Searching", title,
- FALSE, &cf->stop_flag, &start_time, progbar_val);
+ FALSE, &cf->stop_flag, progbar_val);
/*
* Update the progress bar, but do it only after PROGBAR_UPDATE_INTERVAL
GTimer *prog_timer = g_timer_new();
gint64 size;
float progbar_val;
- GTimeVal start_time;
+ gint64 start_time;
gchar status_str[100];
guint32 framenum;
frame_data *fdata;
g_timer_start(prog_timer);
cf->stop_flag = FALSE;
- g_get_current_time(&start_time);
+ start_time = g_get_monotonic_time();
framenum = 0;
wtap_rec_init(&rec);
if (progress_is_slow(progbar, prog_timer, size, cf->f_datalen)) {
progbar_val = calc_progbar_val(cf, size, cf->f_datalen, status_str, sizeof(status_str));
progbar = delayed_create_progress_dlg(cf->window, "Rescanning", name_ptr,
- TRUE, &cf->stop_flag, &start_time, progbar_val);
+ TRUE, &cf->stop_flag, progbar_val);
}
/*
progbar_val = calc_progbar_val(cf, size, cf->f_datalen, status_str, sizeof(status_str));
/* update the packet bar content on the first run or frequently on very large files */
update_progress_dlg(progbar, progbar_val, status_str);
- compute_elapsed(cf, &start_time);
+ compute_elapsed(cf, start_time);
packets_bar_update();
g_timer_start(prog_timer);
}
wtap_sequential_close(cf->provider.wth);
/* compute the time it took to load the file */
- compute_elapsed(cf, &start_time);
+ compute_elapsed(cf, 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