You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works in containers, as we can just use the cgroup files of the container.
In "executable" mode, however, we don't run in separate cgroups, so measuring the existing cgroups will not yield the correct result.
If we move ourselves into a child cgroup of the current one, we can then track that new one.
Note: we sometimes run in semi-containers, such as Databricks / Dataflow / Fargate, where we're an executable but we're on low privileges so I don't know if we can create new cgroups. We need to handle this case as well (that is, do not fail hard if we fail to move cgroups)
Moving cgroups - new process in cgrouup with cgexec
Moving cgroups - existing process in cgroup - this is probably what we should use; not cgclassify but "manually" writing our PID to the tasks file of a new cgroup.
Cgroups are per-thread actually. So we should move our thread to a new cgroup as early as possible (before other threads/processes are spawned), and make sure it's really the only thread in the process once we do so.
The text was updated successfully, but these errors were encountered:
--log-usage
lets us track the CPU & memory usage of gProfiler. It does so by reading cgroups files for the cgroup gProfiler runs in. See https://github.com/Granulate/gprofiler/blob/89fcf8e271706029bedd486b2b35727e92058086/gprofiler/usage_loggers.py for how it's currently done.This works in containers, as we can just use the cgroup files of the container.
In "executable" mode, however, we don't run in separate cgroups, so measuring the existing cgroups will not yield the correct result.
If we move ourselves into a child cgroup of the current one, we can then track that new one.
Note: we sometimes run in semi-containers, such as Databricks / Dataflow / Fargate, where we're an executable but we're on low privileges so I don't know if we can create new cgroups. We need to handle this case as well (that is, do not fail hard if we fail to move cgroups)
Resources:
usage_in_bytes
.cgclassify
but "manually" writing our PID to thetasks
file of a new cgroup.Cgroups are per-thread actually. So we should move our thread to a new cgroup as early as possible (before other threads/processes are spawned), and make sure it's really the only thread in the process once we do so.
The text was updated successfully, but these errors were encountered: