n^2 time on the number of packets). Just prepend to the list, then sort
it when we actually need to calculate the statistics.
Should fix https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=8721
svn path=/trunk/; revision=49606
if (rt == NULL)
return 0;
*rt = resp_time;
if (rt == NULL)
return 0;
*rt = resp_time;
- icmpstat->rt_list = g_slist_insert_sorted(icmpstat->rt_list, rt, compare_doubles);
+ icmpstat->rt_list = g_slist_prepend(icmpstat->rt_list, rt);
icmpstat->num_resps++;
if (icmpstat->min_msecs > resp_time) {
icmpstat->min_frame = trans->resp_frame;
icmpstat->num_resps++;
if (icmpstat->min_msecs > resp_time) {
icmpstat->min_frame = trans->resp_frame;
*/
static void compute_stats(icmpstat_t *icmpstat, double *mean, double *med, double *sdev)
{
*/
static void compute_stats(icmpstat_t *icmpstat, double *mean, double *med, double *sdev)
{
- GSList *slist = icmpstat->rt_list;
double diff;
double sq_diff_sum = 0.0;
double diff;
double sq_diff_sum = 0.0;
+ icmpstat->rt_list = g_slist_sort(icmpstat->rt_list, compare_doubles);
+ slist = icmpstat->rt_list;
+
if (icmpstat->num_resps == 0 || slist == NULL) {
*mean = 0.0;
*med = 0.0;
if (icmpstat->num_resps == 0 || slist == NULL) {
*mean = 0.0;
*med = 0.0;
if (rt == NULL)
return 0;
*rt = resp_time;
if (rt == NULL)
return 0;
*rt = resp_time;
- icmpv6stat->rt_list = g_slist_insert_sorted(icmpv6stat->rt_list, rt, compare_doubles);
+ icmpv6stat->rt_list = g_slist_prepend(icmpv6stat->rt_list, rt);
icmpv6stat->num_resps++;
if (icmpv6stat->min_msecs > resp_time) {
icmpv6stat->min_frame = trans->resp_frame;
icmpv6stat->num_resps++;
if (icmpv6stat->min_msecs > resp_time) {
icmpv6stat->min_frame = trans->resp_frame;
*/
static void compute_stats(icmpv6stat_t *icmpv6stat, double *mean, double *med, double *sdev)
{
*/
static void compute_stats(icmpv6stat_t *icmpv6stat, double *mean, double *med, double *sdev)
{
- GSList *slist = icmpv6stat->rt_list;
double diff;
double sq_diff_sum = 0.0;
double diff;
double sq_diff_sum = 0.0;
+ icmpv6stat->rt_list = g_slist_sort(icmpv6stat->rt_list, compare_doubles);
+ slist = icmpv6stat->rt_list;
+
if (icmpv6stat->num_resps == 0 || slist == NULL) {
*mean = 0.0;
*med = 0.0;
if (icmpv6stat->num_resps == 0 || slist == NULL) {
*mean = 0.0;
*med = 0.0;