From me:
-Slight revision of the patch to prevent overflows
when time_t is 32 bits (eg: on 32 bit Linux);
-Other minor changes.
See: https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4956
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@33721
f5534014-38df-0310-8fa8-
9805f1628bb7
Digium TDMoE protocol dissector
}
Digium TDMoE protocol dissector
}
and by:
Pavel Roskin <proski [AT] gnu.org>
and by:
Pavel Roskin <proski [AT] gnu.org>
Markus Renz <Markus.Renz [AT] hirschmann.de>
Toshihiro Kataoka <kataoka.toshihiro [AT] gmail.com>
Petr Lautrbach <plautrba [AT] redhat.com>
Markus Renz <Markus.Renz [AT] hirschmann.de>
Toshihiro Kataoka <kataoka.toshihiro [AT] gmail.com>
Petr Lautrbach <plautrba [AT] redhat.com>
+Cal Turney <turney_cal [AT] emc.com>
Dan Lasley <dlasley[AT]promus.com> gave permission for his
dumpit() hex-dump routine to be used.
Dan Lasley <dlasley[AT]promus.com> gave permission for his
dumpit() hex-dump routine to be used.
#include "gtk/dlg_utils.h"
#include "gtk/main.h"
#include "gtk/dlg_utils.h"
#include "gtk/main.h"
+#define NANOSECS_PER_SEC 1000000000
static GtkWidget *win=NULL;
static GtkWidget *table=NULL;
static GtkWidget *win=NULL;
static GtkWidget *table=NULL;
rp->tot.secs += delta.secs;
rp->tot.nsecs += delta.nsecs;
rp->tot.secs += delta.secs;
rp->tot.nsecs += delta.nsecs;
- if(rp->tot.nsecs>1000000000){
- rp->tot.nsecs-=1000000000;
+ if(rp->tot.nsecs>NANOSECS_PER_SEC){
+ rp->tot.nsecs-=NANOSECS_PER_SEC;
rp->tot.secs++;
}
rp->num++;
rp->tot.secs++;
}
rp->num++;
{
rpc_program_t *rp;
int i;
{
rpc_program_t *rp;
int i;
-#else
- guint32 td;
-#endif
for(rp=prog_list,i=1;rp;rp=rp->next,i++){
for(rp=prog_list,i=1;rp;rp=rp->next,i++){
- /* scale it to units of 10us.*/
- /* for long captures with a large tot time, this can overflow on 32bit */
- td=(int)rp->tot.secs;
- td=td*100000+(int)rp->tot.nsecs/10000;
- if(rp->num){
- td/=rp->num;
- } else {
+ /* Ignore procedures with no calls */
+ if(rp->num==0){
+ /* Scale the average SRT in units of 1us and round to the nearest us.
+ tot.secs is a time_t which may be 32 or 64 bits (or even floating)
+ depending on the platform. After casting tot.secs to a 64 bits int, it
+ would take a capture with a duration of over 136 *years* to
+ overflow the secs portion of td. */
+ td = ((guint64)(rp->tot.secs))*NANOSECS_PER_SEC + rp->tot.nsecs;
+ td = ((td / rp->num) + 500) / 1000;
g_snprintf(rp->sprogram, sizeof(rp->sprogram), "%s",rpc_prog_name(rp->program));
gtk_label_set_text(GTK_LABEL(rp->wprogram), rp->sprogram);
g_snprintf(rp->sprogram, sizeof(rp->sprogram), "%s",rpc_prog_name(rp->program));
gtk_label_set_text(GTK_LABEL(rp->wprogram), rp->sprogram);
g_snprintf(rp->snum, sizeof(rp->snum), "%d",rp->num);
gtk_label_set_text(GTK_LABEL(rp->wnum), rp->snum);
g_snprintf(rp->snum, sizeof(rp->snum), "%d",rp->num);
gtk_label_set_text(GTK_LABEL(rp->wnum), rp->snum);
- g_snprintf(rp->smin, sizeof(rp->smin), "%3d.%05d",(int)rp->min.secs,(int)rp->min.nsecs/10000);
+ g_snprintf(rp->smin, sizeof(rp->smin), "%3d.%06d",(int)rp->min.secs, (rp->min.nsecs+500)/1000);
gtk_label_set_text(GTK_LABEL(rp->wmin), rp->smin);
gtk_label_set_text(GTK_LABEL(rp->wmin), rp->smin);
- g_snprintf(rp->smax, sizeof(rp->smax), "%3d.%05d",(int)rp->max.secs,(int)rp->max.nsecs/10000);
+ g_snprintf(rp->smax, sizeof(rp->smax), "%3d.%06d",(int)rp->max.secs, (rp->max.nsecs+500)/1000);
gtk_label_set_text(GTK_LABEL(rp->wmax), rp->smax);
gtk_label_set_text(GTK_LABEL(rp->wmax), rp->smax);
- g_snprintf(rp->savg, sizeof(rp->savg), "%3d.%05d",(int)td/100000,(int)td%100000);
+ g_snprintf(rp->savg, sizeof(rp->savg), "%3d.%06d",(int)(td/1000000),(int)(td%1000000));
gtk_label_set_text(GTK_LABEL(rp->wavg), rp->savg);
}
gtk_label_set_text(GTK_LABEL(rp->wavg), rp->savg);
}
#include "gtk/filter_utils.h"
#include "gtk/gui_utils.h"
#include "gtk/filter_utils.h"
#include "gtk/gui_utils.h"
+#define NANOSECS_PER_SEC 1000000000
+
g_object_set(renderer, "text", "", NULL);
return;
}
g_object_set(renderer, "text", "", NULL);
return;
}
- str = g_strdup_printf("%3d.%05d", (int)data->secs, data->nsecs/10000);
+ str = g_strdup_printf("%3d.%06d", (int)data->secs, (data->nsecs+500)/1000);
g_object_set(renderer, "text", str, NULL);
g_free(str);
}
g_object_set(renderer, "text", str, NULL);
g_free(str);
}
gint data_column = GPOINTER_TO_INT(user_data);
gtk_tree_model_get(model, iter, data_column, &td, -1);
gint data_column = GPOINTER_TO_INT(user_data);
gtk_tree_model_get(model, iter, data_column, &td, -1);
- str=g_strdup_printf("%3" G_GINT64_MODIFIER "d.%05" G_GINT64_MODIFIER "d",
- td/100000, td%100000);
+ str=g_strdup_printf("%3d.%06d",
+ (int)(td/1000000), (int)(td%1000000));
g_object_set(renderer, "text", str, NULL);
g_free(str);
}
g_object_set(renderer, "text", str, NULL);
g_free(str);
}
if(rst->procedures[i].stats.num==0){
continue;
}
if(rst->procedures[i].stats.num==0){
continue;
}
+ /* Scale the average SRT in units of 1us and round to the nearest us.
+ tot.secs is a time_t which may be 32 or 64 bits (or even floating)
+ depending uon the platform. After casting tot.secs to 64 bits, it
+ would take a capture with a duration of over 136 *years* to
+ overflow the secs portion of td. */
+ td = ((guint64)(rst->procedures[i].stats.tot.secs))*NANOSECS_PER_SEC + rst->procedures[i].stats.tot.nsecs;
+ td = ((td / rst->procedures[i].stats.num) + 500) / 1000;
- /* scale it to units of 10us.*/
- /* for long captures with a large tot time, this can overflow on 32bit */
- td=(int)rst->procedures[i].stats.tot.secs;
- td=td*100000+(int)rst->procedures[i].stats.tot.nsecs/10000;
- td/=rst->procedures[i].stats.num;
gtk_list_store_set(store, &rst->procedures[i].iter,
CALLS_COLUMN, rst->procedures[i].stats.num,
MIN_SRT_COLUMN, &rst->procedures[i].stats.min,
gtk_list_store_set(store, &rst->procedures[i].iter,
CALLS_COLUMN, rst->procedures[i].stats.num,
MIN_SRT_COLUMN, &rst->procedures[i].stats.min,