mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
capture: add pid-root frame type
While I'm not thrilled to add new frame types for every sort of thing, I think having this will be relatively useful so we can improve decoding operations. This adds SysprofCapturePidRoot which lets us specify a root directory on the host system for which is the real root (/) of the PID. This can be useful when reconstructing overlays for containers and you need to direct access to alternate roots. The layer gives us some ability to try to deal with overlayfs, albeit at a very rudimentary level. In most cases I anticipate we just deal with the main root and ignore overlays until necessary.
This commit is contained in:
@ -827,6 +827,39 @@ sysprof_capture_writer_add_fork (SysprofCaptureWriter *self,
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
sysprof_capture_writer_add_pid_root (SysprofCaptureWriter *self,
|
||||
int64_t time,
|
||||
int cpu,
|
||||
int32_t pid,
|
||||
const char *path,
|
||||
uint32_t layer)
|
||||
{
|
||||
SysprofCapturePidRoot *ev;
|
||||
size_t strl = strlen (path);
|
||||
size_t len = sizeof *ev + strl + 1;
|
||||
|
||||
assert (self != NULL);
|
||||
|
||||
ev = (SysprofCapturePidRoot *)sysprof_capture_writer_allocate (self, &len);
|
||||
if (!ev)
|
||||
return false;
|
||||
|
||||
sysprof_capture_writer_frame_init (&ev->frame,
|
||||
len,
|
||||
cpu,
|
||||
pid,
|
||||
time,
|
||||
SYSPROF_CAPTURE_FRAME_PID_ROOT);
|
||||
ev->layer = layer;
|
||||
memcpy (ev->path, path, strl);
|
||||
ev->path[strl] = 0;
|
||||
|
||||
self->stat.frame_count[SYSPROF_CAPTURE_FRAME_PID_ROOT]++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
sysprof_capture_writer_add_exit (SysprofCaptureWriter *self,
|
||||
int64_t time,
|
||||
|
||||
Reference in New Issue
Block a user