Files
luban-lite-t3e-pro/bsp/common/utils/show_speed.c

28 lines
572 B
C
Raw Normal View History

2024-04-03 16:40:57 +08:00
/*
* Copyright (c) 2024, ArtInChip Technology Co., Ltd
*
* SPDX-License-Identifier: Apache-2.0
*
* Authors: Wu Dehuang <dehuang.wu@artinchip.com>
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <aic_utils.h>
#include <aic_common.h>
void show_speed(char *msg, unsigned long len, unsigned long us)
{
unsigned long tmp, speed;
/* Split to serval step to avoid overflow */
tmp = 1000 * len;
tmp = tmp / us;
tmp = 1000 * tmp;
speed = tmp / 1024;
printf("%s: %ld byte, %ld us -> %ld KB/s\n", msg, len, us, speed);
}