测量 Linux 系统调用消耗的时间
测量 Linux 系统调用消耗的时间
源代码仓库:https://gitcode.com/opensourceworld/sys_call_cost
In this homework, you’ll measure the costs of a system call. Measuring the cost of a system call is relatively easy. For example, you could repeatedly call a simple system call(e.g., performing a 0-byte read), and time how long it takes; dividing the time bgy the number of iterations gives you an
estimate of the cost of a system call.
根据 gettimeofday
的手册,这个函数已经过时 了,应该使用 clock_gettime
函数。看了一下文档,发现 clock_gettime
使用 CLOCK_REALTIME
时,和 gettimeofday
相同,都是计算相对于 Epoch 的时间。也要看看其它类型的 CLOCK。
2025年4月29日星期二 23:01