Exemplo n.º 1
0
static int long_seq_test_calc_throughput(struct test_data *td)
{
	unsigned long fraction, integer;
	unsigned long mtime, byte_count;

	mtime = ktime_to_ms(utd->test_info.test_duration);
	byte_count = utd->test_info.test_byte_count;

	pr_info("%s: time is %lu msec, size is %lu.%lu MiB", __func__, mtime,
				LONG_TEST_SIZE_INTEGER(byte_count),
				LONG_TEST_SIZE_FRACTION(byte_count));

	/* we first multiply in order not to lose precision */
	mtime *= MB_MSEC_RATIO_APPROXIMATION;
	/* divide values to get a MiB/sec integer value with one
	   digit of precision
	   */
	fraction = integer = (byte_count * 10) / mtime;
	integer /= 10;
	/* and calculate the MiB value fraction */
	fraction -= integer * 10;

	pr_info("%s: Throughput: %lu.%lu MiB/sec\n", __func__, integer,
				fraction);

	return 0;
}
void long_seq_test_calc_throughput(unsigned long mtime,
				   unsigned long byte_count)
{
	unsigned long fraction, integer;

	test_pr_info("%s: time is %lu msec, size is %lu.%lu MiB",
			__func__, mtime, LONG_TEST_SIZE_INTEGER(byte_count),
				LONG_TEST_SIZE_FRACTION(byte_count));

	
	mtime *= MB_MSEC_RATIO_APPROXIMATION;
	fraction = integer = (byte_count * 10) / mtime;
	integer /= 10;
	
	fraction -= integer * 10;

	test_pr_info("%s: Throughput: %lu.%lu MiB/sec\n",
		__func__, integer, fraction);
}
void long_seq_test_calc_throughput(unsigned long mtime,
				   unsigned long byte_count)
{
	unsigned long fraction, integer;

	test_pr_info("%s: time is %lu msec, size is %lu.%lu MiB",
			__func__, mtime, LONG_TEST_SIZE_INTEGER(byte_count),
				LONG_TEST_SIZE_FRACTION(byte_count));

	/* we first multiply in order not to lose precision */
	mtime *= MB_MSEC_RATIO_APPROXIMATION;
	/* divide values to get a MiB/sec integer value with one
	   digit of precision
	   */
	fraction = integer = (byte_count * 10) / mtime;
	integer /= 10;
	/* and calculate the MiB value fraction */
	fraction -= integer * 10;

	test_pr_info("%s: Throughput: %lu.%lu MiB/sec\n",
		__func__, integer, fraction);
}