Open bethebest0622 opened 8 months ago
int main() { co_sched.goStart(0); timeval t; gettimeofday(&t, NULL); go [] {}; timeval t2; gettimeofday(&t2, NULL); int latency = (t2.tv_sec - t.tv_sec) * 1000000 + (t2.tv_usec - t.tv_usec); printf("cost %d\n", latency);
这段代码需要20us,空载的延迟这么高吗
已收到您的邮件,如有问题会尽快给您回复.
仅仅测试单个耗时极短的函数开销意义不大,毕竟gettimeofday也是有开销的。可以循环运行百万次、千万次以使误差更小。
可以加个vx聊聊吗
这段代码需要20us,空载的延迟这么高吗