summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry/kernel/task_syscall.go
diff options
context:
space:
mode:
authorAdin Scannell <ascannell@google.com>2019-12-06 16:58:28 -0800
committergVisor bot <gvisor-bot@google.com>2019-12-06 17:00:07 -0800
commit371e210b83c244d8828ad2fa1b3d7cef15fbf463 (patch)
tree6617af43e8182a9784ac5525ac3e9fe5d8543aa0 /pkg/sentry/kernel/task_syscall.go
parent3e84777d2e2a2b56c00487cd77aa8d2fc25bbb16 (diff)
Add runtime tracing.
This adds meaningful annotations to the trace generated by the runtime/trace package. PiperOrigin-RevId: 284290115
Diffstat (limited to 'pkg/sentry/kernel/task_syscall.go')
-rw-r--r--pkg/sentry/kernel/task_syscall.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/sentry/kernel/task_syscall.go b/pkg/sentry/kernel/task_syscall.go
index b543d536a..3180f5560 100644
--- a/pkg/sentry/kernel/task_syscall.go
+++ b/pkg/sentry/kernel/task_syscall.go
@@ -17,6 +17,7 @@ package kernel
import (
"fmt"
"os"
+ "runtime/trace"
"syscall"
"gvisor.dev/gvisor/pkg/abi/linux"
@@ -160,6 +161,10 @@ func (t *Task) executeSyscall(sysno uintptr, args arch.SyscallArguments) (rval u
ctrl = ctrlStopAndReinvokeSyscall
} else {
fn := s.Lookup(sysno)
+ var region *trace.Region // Only non-nil if tracing == true.
+ if trace.IsEnabled() {
+ region = trace.StartRegion(t.traceContext, s.LookupName(sysno))
+ }
if fn != nil {
// Call our syscall implementation.
rval, ctrl, err = fn(t, args)
@@ -167,6 +172,9 @@ func (t *Task) executeSyscall(sysno uintptr, args arch.SyscallArguments) (rval u
// Use the missing function if not found.
rval, err = t.SyscallTable().Missing(t, sysno, args)
}
+ if region != nil {
+ region.End()
+ }
}
if bits.IsOn32(fe, ExternalAfterEnable) && (s.ExternalFilterAfter == nil || s.ExternalFilterAfter(t, sysno, args)) {