如何确定code花费了大量的时间在内核空间(系统调用) [英] How to determine where code spends a lot of time in a kernel space (system calls)

查看:186
本文介绍了如何确定code花费了大量的时间在内核空间(系统调用)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,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:


  1. -T 来显示每个系统调用所花费的时间,

  2. -c 来总结的系统调用数,调用,错误计数为表。

  1. -T to show the time spent in each system call,
  2. -c to summarize syscall counts, calls, error counts as a table.

这两个选项是相互排斥的,但。

The two options are mutually exclusive though.

您可能需要一个完整的系统性能分析工具,允许你分析内核的更多细节。 的DTrace 可能是最好的,如果你拥有它您的平台。

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的, oprofile的,的 SystemTap的

  • 的Solaris:的DTrace (原)

  • FreeBSD的:的DTrace

  • OS X:<一href=\"http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/dtrace.1.html\"相对=nofollow> 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花费了大量的时间在内核空间(系统调用)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆