• 15
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

name Punditsdkoslkdosdkoskdo

What is the difference between truss -D and truss -E?

I am currently analyzing a command on Solaris that reads from a file and has very low performance. The truss -D commands shows me read system calls taking up to 0.03 seconds, but when I use truss -E, they are always either 0.0000 or 0.0001 (two orders of magnitude lower than with the -D option). In the man page, it says:

 -D
     Includes a time delta on each line of trace output.  The
     value appears as a field containing seconds.fraction and
     represents the elapsed time for the  LWP  that  incurred
     the event since the last reported event incurred by that
     LWP. Specifically, for system calls,  this  is  not  the
     time spent within the system call.

 -E
     Includes a time delta on each line of trace output.  The
     value appears as a field containing seconds.fraction and
     represents the difference in time  elapsed  between  the
     beginning and end of a system call.

     In contrast to  the -D option, this  is  the  amount  of
     time spent within the system call.

So the -E option measures the actual time spent within the system call, while -D does not... Can anyone explain what exactly is it that makes that difference? What is being done in the remaining time "outside" the system call?

Based on the documentation you quoted I find it quite clear that one is covering the entire duration from one system call to the next, while the other covers only the time within a system call.

The percentage of time spent inside system calls versus the percentage of time spent outside system calls will roughly tell you if a process is CPU bound.

A CPU bound process spend most of its time outside system calls. This is the state a process will be in, while it is performing computations. For a CPU bound process the difference between the two numbers will be large, and probably by at least an order of magnitude.

A process which is not CPU bound will be blocked waiting for events most of the time. Since blocking can only happen inside system calls. For a process which is not CPU bound, the numbers will be approximately identical (probably only differing by a one digit percentage).

That was the simple explanation, in reality there is a few more aspects to consider. Due to memory mapping and swapping, a process can actually block without being in a system calls. Additionally the kernel could offer features, which involve computations inside kernel code. That could lead to a process spending most time inside system calls and still be CPU bound. The latter for example could happen when using encrypted file systems.

  • 2
Reply Report
    • This answer is not really Solaris specific. What I am explaining would apply to pretty much any unix system.
      • 2
    • Now I'm confused, because the slow process that I'm analyzing is not using any noticeable CPU resources. It is spending a long time reading and seeking through files, the slowness seems to be caused by disk problems...
    • @Dominik I reread the quoted documentation and my answer, and I didn't find details which did not add up. But if you are seeing other data contradicting the conclusion that the process is CPU bound, then surely something must be amiss somewhere. And it may be that the documentation you quoted is erroneous or incomplete. If that turns out to be the case, then you don't just need somebody who can tell you how to read that documentation, but somebody who knows in which places the documentation is incorrect. And that would mean very specific Solaris knowledge (my knowledge of Solaris is not that d

Trending Tags