summaryrefslogtreecommitdiffhomepage
path: root/pkg/sentry
diff options
context:
space:
mode:
authorRahat Mahmood <rahat@google.com>2018-09-13 15:15:33 -0700
committerShentubot <shentubot@google.com>2018-09-13 15:16:47 -0700
commitadf8f339703922211886d3e5588160f65bc131b3 (patch)
tree4b40216f0fe0b8ec2130295a4a3fef792ac6b3cf /pkg/sentry
parent9c6b38e2952650cba32e21d0719bcb0ffdc10860 (diff)
Extend memory usage events to report mapped memory usage.
PiperOrigin-RevId: 212887555 Change-Id: I3545383ce903cbe9f00d9b5288d9ef9a049b9f4f
Diffstat (limited to 'pkg/sentry')
-rw-r--r--pkg/sentry/kernel/memevent/memory_events.go5
-rw-r--r--pkg/sentry/kernel/memevent/memory_events.proto4
2 files changed, 8 insertions, 1 deletions
diff --git a/pkg/sentry/kernel/memevent/memory_events.go b/pkg/sentry/kernel/memevent/memory_events.go
index ecc9151de..f7a183a1d 100644
--- a/pkg/sentry/kernel/memevent/memory_events.go
+++ b/pkg/sentry/kernel/memevent/memory_events.go
@@ -94,5 +94,8 @@ func (m *MemoryEvents) emit() {
snapshot, _ := usage.MemoryAccounting.Copy()
total := totalPlatform + snapshot.Mapped
- eventchannel.Emit(&pb.MemoryUsageEvent{Total: total})
+ eventchannel.Emit(&pb.MemoryUsageEvent{
+ Mapped: snapshot.Mapped,
+ Total: total,
+ })
}
diff --git a/pkg/sentry/kernel/memevent/memory_events.proto b/pkg/sentry/kernel/memevent/memory_events.proto
index e6e0bd628..abc565054 100644
--- a/pkg/sentry/kernel/memevent/memory_events.proto
+++ b/pkg/sentry/kernel/memevent/memory_events.proto
@@ -22,4 +22,8 @@ message MemoryUsageEvent {
// The total memory usage of the sandboxed application in bytes, calculated
// using the 'fast' method.
uint64 total = 1;
+
+ // Memory used to back memory-mapped regions for files in the application, in
+ // bytes. This corresponds to the usage.MemoryKind.Mapped memory type.
+ uint64 mapped = 2;
}