Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Issue 997009: Compute and pring the time that it takes to execute system calls. This data... (Closed)

Created:
10 years, 9 months ago by Markus (顧孟勤)
Modified:
9 years, 7 months ago
Reviewers:
agl
CC:
chromium-reviews, Evan Martin
Visibility:
Public.

Description

Compute and pring the time that it takes to execute system calls. This data is going to be skewed slightly, as calling gettimeofday() by itself also takes a little bit of time. But it should be good enough to allow us to see where we have performance bottlenecks. TEST=none BUG=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=41905

Patch Set 1 #

Total comments: 6

Patch Set 2 : '' #

Total comments: 6

Patch Set 3 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+327 lines, -84 lines) Patch
M sandbox/linux/seccomp/access.cc View 2 chunks +3 lines, -1 line 0 comments Download
M sandbox/linux/seccomp/clone.cc View 2 chunks +3 lines, -1 line 0 comments Download
M sandbox/linux/seccomp/debug.h View 1 2 2 chunks +16 lines, -2 lines 0 comments Download
M sandbox/linux/seccomp/debug.cc View 1 2 3 chunks +180 lines, -46 lines 0 comments Download
M sandbox/linux/seccomp/exit.cc View 1 chunk +2 lines, -1 line 0 comments Download
M sandbox/linux/seccomp/getpid.cc View 1 chunk +3 lines, -1 line 0 comments Download
M sandbox/linux/seccomp/gettid.cc View 1 chunk +5 lines, -2 lines 0 comments Download
M sandbox/linux/seccomp/ioctl.cc View 2 chunks +3 lines, -1 line 0 comments Download
M sandbox/linux/seccomp/ipc.cc View 7 chunks +15 lines, -5 lines 0 comments Download
M sandbox/linux/seccomp/madvise.cc View 2 chunks +3 lines, -1 line 0 comments Download
M sandbox/linux/seccomp/mmap.cc View 1 3 chunks +7 lines, -1 line 0 comments Download
M sandbox/linux/seccomp/mprotect.cc View 2 chunks +3 lines, -1 line 0 comments Download
M sandbox/linux/seccomp/munmap.cc View 2 chunks +3 lines, -1 line 0 comments Download
M sandbox/linux/seccomp/open.cc View 2 chunks +3 lines, -1 line 0 comments Download
M sandbox/linux/seccomp/securemem.h View 1 chunk +11 lines, -1 line 0 comments Download
M sandbox/linux/seccomp/socketcall.cc View 13 chunks +30 lines, -7 lines 0 comments Download
M sandbox/linux/seccomp/stat.cc View 5 chunks +12 lines, -4 lines 0 comments Download
M sandbox/linux/seccomp/syscall.cc View 1 4 chunks +10 lines, -7 lines 0 comments Download
M sandbox/linux/seccomp/trusted_process.cc View 2 chunks +11 lines, -0 lines 0 comments Download
M sandbox/linux/seccomp/trusted_thread.cc View 2 chunks +4 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
Markus (顧孟勤)
10 years, 9 months ago (2010-03-17 01:16:20 UTC) #1
Evan Martin
I can't review the asm bits, I think you need agl. http://codereview.chromium.org/997009/diff/1/10 File sandbox/linux/seccomp/debug.h (right): ...
10 years, 9 months ago (2010-03-17 17:24:38 UTC) #2
Markus (顧孟勤)
I was so hoping that I could get Evan to review this change, as I ...
10 years, 9 months ago (2010-03-17 19:30:38 UTC) #3
agl
10 years, 9 months ago (2010-03-17 19:59:46 UTC) #4
LGTM.

(p.s. I haven't left Chrome team in any useful sense so feel free to send CLs my
way :)

http://codereview.chromium.org/997009/diff/22001/15020
File sandbox/linux/seccomp/debug.cc (right):

http://codereview.chromium.org/997009/diff/22001/15020#newcode133
sandbox/linux/seccomp/debug.cc:133: asm volatile("mov  %%gs, %0\n"
Why test for GS == 0? Can we be running without TLS? (Worth a comment.)

Later: ok, I see why. Certainly worth a comment.

http://codereview.chromium.org/997009/diff/22001/15020#newcode228
sandbox/linux/seccomp/debug.cc:228: *tm = 1000*1000*tv.tv_sec + tv.tv_usec;
You know the rules better than I here, but I worry about overflow. tv.tv_sec is
just a time_t so I worry that the multiplication is done in that type.

http://codereview.chromium.org/997009/diff/22001/15020#newcode245
sandbox/linux/seccomp/debug.cc:245: itoa(const_cast<char *>(strrchr(sysname =
unnamed, '\000')), sysnum);
Pick whichever you like, but you could save the strrchr:

static const char kUnnamedMessage[] = "Unnamed syscall #";

char buffer[40];
memcpy(buffer, kUnnamedMessage, sizeof(kUnnamedMessage) - 1);
itoa(buffer + sizeof(kUnnamedMessage) - 1, sysnum)

http://codereview.chromium.org/997009/diff/22001/15020#newcode281
sandbox/linux/seccomp/debug.cc:281: static const char *extra = "";
static const char extra[1] = {0};  <- saves a relocation record.

http://codereview.chromium.org/997009/diff/22001/15010
File sandbox/linux/seccomp/debug.h (right):

http://codereview.chromium.org/997009/diff/22001/15010#newcode63
sandbox/linux/seccomp/debug.h:63: static inline bool enter();
I think inline is worthless here:

"GCC does not inline any functions when not optimizing unless you specify the
`always_inline' attribute for the function, like this" [1]

When optimising, GCC will apply the usual heuristics for inlining anway, and
probably does a better-than-human job at it.

[1] http://gcc.gnu.org/onlinedocs/gcc-4.4.3/gcc/Inline.html

http://codereview.chromium.org/997009/diff/22001/15010#newcode72
sandbox/linux/seccomp/debug.h:72: static int  numSyscallNames_;
Missing alignment space before "num..." here?

Powered by Google App Engine
This is Rietveld 408576698