Linux 进程活动

发布于 2024-12-08 21:13:18 字数 212 浏览 0 评论 0原文

是否有可能显示Linux中指定进程下发生的情况?

例如,我运行 SQL 查询 -> 选择邪恶函数(); 并注意 Linux 下的进程使用所有 cpu。

那么我可以看到此过程中发生了什么吗?

我想要的是查看此进程下正在运行哪些查询。

谢谢!

Is there possibility to show what's going on under specified process in Linux?

For example, i run SQL query -> select evil_function();
and notice that process under Linux uses all cpu.

So is there something with what I can see whats going on under this process?

What I want is to see what queries is running under this process.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

三生一梦 2024-12-15 21:13:18

strace 会告诉您进程正在执行什么系统调用

要查看哪些调用的例程占用了最多的 CPU,您需要运行分析工具,并确保正确编译的进程的可执行文件(有时需要在编译期间进行分析以进行检测,有时只需要编译带有调试符号,或者编译后不删除它们)。

您可能想看看 oprofilevalgrindgprof 以及免费工具的初学者 - 也有可用的商业产品。

以下是一些链接:

http://www.pixelbeat.org/programming/profiling/

http://en.wikipedia.org/wiki/List_of_performance_analysis_tools

strace will tell you what system calls the process is making.

To see what called routines are taking the most CPU, you need to run a profiling tool, and make sure the executable of the process you in compiled correctly (sometimes it needs to be instrumented during compilation for profiling, sometimes it just needs to be compiled with debug symbols, or not stripped of them after compilation).

You might want to look at oprofile, valgrind, gprof and for starters on free tools - there are also commercial products available.

Here are a few links:

http://www.pixelbeat.org/programming/profiling/

http://en.wikipedia.org/wiki/List_of_performance_analysis_tools

风为裳 2024-12-15 21:13:18

你正在混合一大堆东西。

如果您正在谈论 MySQL,请执行以下操作:

show processlist;

有关 linux 进程的具体信息,您可以 strace 进程来获取它调用的系统函数的列表。除非你对 Linux 有经验,否则这对你来说毫无用处。

如果进程暂停,那么您可以找出它停止在哪个函数上,但这可能不是您想要的,因为您说进程正在运行。

还有各种工具可以为您提供有关进程正在读取磁盘的哪些部分以及分配了多少内存的信息。

最后,您可以使用 gdb 来闯入该进程并单步执行它以查看它到底在做什么。这对你来说也可能没什么用,因为 SQL 服务器做了很多事情——用这种方法来理解很多事情。

You are mixing a whole bunch of things.

If you are talking about MySQL do:

show processlist;

For info specifically about linux processes, you can strace the process to get a list of system function that it calls. Unless you are experienced with linux this will be useless to you.

If the process is paused then you can find out what function it is stopped on, but that's probably not what you want, since you say the process is running.

There are also various tools that can give you info on what parts of the disk the process is reading, and how much memory it's allocating.

And finally you can use gdb to break into the process and single step your way through it to see exactly what it's doing. This will also likely be useless to you since an SQL server does a LOT of things - far to many to understand by this method.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文