Example #1
0
void tcp_print_sum(tpg_profile* prof)
{
	int i = -1;
	long long int start_t_us;
	long long int end_t_us;
	double        total_sent_byte = 0.0;
	char          total_sent_conv[11];
	double        duration_t_us = 0.0;
	double        goodput_byte_per_sec = 0.0;
	char          goodput_conv[11];

	prof->end_time_us = get_currtime_us();
	start_t_us = prof->start_time_us - prof->start_time_us;
	end_t_us = prof->end_time_us - prof->start_time_us;
	duration_t_us = (end_t_us - start_t_us) * 1.0;

	for(i = 0; i < prof->accept_stream_num; i++) {
		total_sent_byte += (prof->stream_list)[i]->stream_result.total_sent_bytes;
	}	
	unit_format(total_sent_conv, 11, total_sent_byte, 'A');

	goodput_byte_per_sec = total_sent_byte / (duration_t_us / TPG_ONE_MILLION);
	unit_format(goodput_conv, 11, goodput_byte_per_sec, 'a');

	TPG_LOG(LOG_PERF,
		"[SUM]  %-4lld->%4lld    %s   %s/s",
		start_t_us / TPG_ONE_MILLION, end_t_us / TPG_ONE_MILLION,
		total_sent_conv,
		goodput_conv);
}
Example #2
0
static void
update_result_label(MathConverter *converter)
{
    MPNumber x, z;
    gboolean enabled;

    if (!converter->priv->result_label)
        return;

    if (math_equation_get_number(converter->priv->equation, &x))
        enabled = convert_equation(converter, &x, &z);
    else
        enabled = FALSE;

    gtk_widget_set_sensitive(converter->priv->result_label, enabled);
    if (enabled) {
        gchar *source_text, *target_text, *label;
        Unit *source_unit, *target_unit;

        math_converter_get_conversion(converter, &source_unit, &target_unit);

        source_text = unit_format(source_unit, &x);
        target_text = unit_format(target_unit, &z);
        label = g_strdup_printf("%s = %s", source_text, target_text);
        gtk_label_set_text(GTK_LABEL(converter->priv->result_label), label);

        g_free(source_text);
        g_free(target_text);
        g_free(label);

        g_object_unref(source_unit);
        g_object_unref(target_unit);
    }
}
Example #3
0
void tcp_print_interval_stream(tpg_stream* pst)
{
	long long int start_t_us = 0;
	long long int end_t_us = 0;
	double        total_sent_byte = 0.0;
	char          total_sent_conv[11];
	double        duration_t_us = 0.0;
	double        goodput_byte_per_sec = 0.0;
	char          goodput_conv[11];

	pst->stream_to_profile->end_time_us = \
		pst->stream_result.end_time_usec = \
		get_currtime_us();
	start_t_us = \
		pst->stream_result.interval_time_usec - pst->stream_result.start_time_usec;
	end_t_us = \
		pst->stream_result.end_time_usec - pst->stream_result.start_time_usec;
	pst->stream_result.interval_time_usec = get_currtime_us();
	duration_t_us = (end_t_us - start_t_us) * 1.0;
	
	total_sent_byte = \
		(pst->stream_result.total_sent_bytes - pst->stream_result.interval_sent_bytes) * 1.0;
	pst->stream_result.interval_sent_bytes = pst->stream_result.total_sent_bytes;
	unit_format(total_sent_conv, 11, total_sent_byte, 'A');

	goodput_byte_per_sec = total_sent_byte / (duration_t_us / TPG_ONE_MILLION); // byte/sec
	unit_format(goodput_conv, 11, goodput_byte_per_sec, 'a');

	if (pst->stream_to_profile->is_multi_nic_enabled > 0) {
		TPG_LOG(LOG_PERF, 
			"[%3d]  %-4lld->%4lld    %s   %s/s    (%s,%s)",
			pst->stream_id,
			start_t_us / TPG_ONE_MILLION,
			end_t_us / TPG_ONE_MILLION,
			total_sent_conv,
			goodput_conv,
			pst->stream_src_ip,
			pst->stream_dst_ip);
	} else {
		TPG_LOG(LOG_PERF, 
		"[%3d]  %-4lld->%4lld    %s   %s/s",
		pst->stream_id,
		start_t_us / TPG_ONE_MILLION,
		end_t_us / TPG_ONE_MILLION,
		total_sent_conv,
		goodput_conv);
	}
}