summaryrefslogtreecommitdiffstats
path: root/sandbox/linux/seccomp/syscall.cc
diff options
context:
space:
mode:
authormarkus@chromium.org <markus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-18 01:05:59 +0000
committermarkus@chromium.org <markus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-18 01:05:59 +0000
commit62dc1f04051694ae381488ef44fad336c6260ad6 (patch)
tree52ddd2c05f774115269541940c3bb32ddffba215 /sandbox/linux/seccomp/syscall.cc
parentec64212b924d80d3ba5da864812b8dea1132854e (diff)
downloadchromium_src-62dc1f04051694ae381488ef44fad336c6260ad6.zip
chromium_src-62dc1f04051694ae381488ef44fad336c6260ad6.tar.gz
chromium_src-62dc1f04051694ae381488ef44fad336c6260ad6.tar.bz2
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 Review URL: http://codereview.chromium.org/997009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41905 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/linux/seccomp/syscall.cc')
-rw-r--r--sandbox/linux/seccomp/syscall.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/sandbox/linux/seccomp/syscall.cc b/sandbox/linux/seccomp/syscall.cc
index d3dc7aa..7f431a3 100644
--- a/sandbox/linux/seccomp/syscall.cc
+++ b/sandbox/linux/seccomp/syscall.cc
@@ -271,19 +271,20 @@ void* Sandbox::defaultSystemCallHandler(int syscallNum, void* arg0, void* arg1,
// these system calls are not restricted in Seccomp mode. But depending on
// the exact instruction sequence in libc, we might not be able to reliably
// filter out these system calls at the time when we instrument the code.
- SysCalls sys;
- long rc;
+ SysCalls sys;
+ long rc;
+ long long tm;
switch (syscallNum) {
case __NR_read:
- Debug::syscall(syscallNum, "Allowing unrestricted system call");
+ Debug::syscall(&tm, syscallNum, "Allowing unrestricted system call");
rc = sys.read((long)arg0, arg1, (size_t)arg2);
break;
case __NR_write:
- Debug::syscall(syscallNum, "Allowing unrestricted system call");
+ Debug::syscall(&tm, syscallNum, "Allowing unrestricted system call");
rc = sys.write((long)arg0, arg1, (size_t)arg2);
break;
case __NR_rt_sigreturn:
- Debug::syscall(syscallNum, "Allowing unrestricted system call");
+ Debug::syscall(&tm, syscallNum, "Allowing unrestricted system call");
rc = sys.rt_sigreturn((unsigned long)arg0);
break;
default:
@@ -295,7 +296,7 @@ void* Sandbox::defaultSystemCallHandler(int syscallNum, void* arg0, void* arg1,
if ((unsigned)syscallNum <= maxSyscall &&
syscallTable[syscallNum].handler == UNRESTRICTED_SYSCALL) {
- Debug::syscall(syscallNum, "Allowing unrestricted system call");
+ Debug::syscall(&tm, syscallNum, "Allowing unrestricted system call");
perform_unrestricted:
struct {
int sysnum;
@@ -309,9 +310,10 @@ void* Sandbox::defaultSystemCallHandler(int syscallNum, void* arg0, void* arg1,
read(sys, thread, &rc, sizeof(rc)) != sizeof(rc)) {
die("Failed to forward unrestricted system call");
}
+ Debug::elapsed(tm, syscallNum);
return rc;
} else if (Debug::isEnabled()) {
- Debug::syscall(syscallNum,
+ Debug::syscall(&tm, syscallNum,
"In production mode, this call would be disallowed");
goto perform_unrestricted;
} else {
@@ -321,6 +323,7 @@ void* Sandbox::defaultSystemCallHandler(int syscallNum, void* arg0, void* arg1,
if (rc < 0) {
rc = -sys.my_errno;
}
+ Debug::elapsed(tm, syscallNum);
return (void *)rc;
}