问题描述
我注意到,10%我的code运行的系统空间。不过,我不知道哪个系统调用。我怀疑,虽然,它要么是必须做的文件或时间戳。
I noticed that 10% my code run is system space. However I do NOT know which system calls. I suspect, though, it is either has to do files or timestamps.
有没有办法找出哪些系统调用是匪徒的工具吗?另外,我想知道的电话(方和被叫方)的频率(和地点)。
Is there a tool to figure out which system calls are the culprits? Also, I want to know the frequency of (and location) of calls (and callee) .
我在AS3
THX
推荐答案
两个 strace的
和桁架
将帮助你看看哪些系统调用正在服用的时间。为 strace的
两个有用的选项是:
Both strace
and truss
will help you see which system calls are taking time. Two useful options for strace
are:
-
-T
来显示每个系统调用所花费的时间, -
-c
来总结的系统调用数,调用,错误计数为表。
-T
to show the time spent in each system call,-c
to summarize syscall counts, calls, error counts as a table.
这两个选项是相互排斥的,但。
The two options are mutually exclusive though.
您可能需要一个完整的系统性能分析工具,允许你分析内核的更多细节。 可能是最好的,如果你拥有它您的平台。
You may want a full system profiling tool, to allow you to profile the kernel in more detail. DTrace is probably the best if you have it on your platform.
通过平台,这里有一些选择:
By platform, here are some options:
- 的Linux:strace的,,的。
- 的Solaris:(原)
- FreeBSD的:
- OS X: DTrace的和;后者是超过一个的DTrace图形UI,并配备了X $ C $角
- Linux: strace, oprofile, SystemTap.
- Solaris: dtrace (the original)
- FreeBSD: dtrace
- OS X: dtrace and Instruments; the latter is a graphical UI over DTrace and comes with Xcode.
DTrace的,甚至可以帮助您分析您的C / C ++ code与pid提供,例如看到。
DTrace can even help you profile your C/C++ code with the pid provider, e.g. see here.
这篇关于如何确定code花费了大量的时间在内核空间(系统调用)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!