[systemd-devel] systemd-time

Lennart Poettering lennart at poettering.net
Sun Sep 29 12:47:17 PDT 2013


On Sun, 29.09.13 20:11, Andi Kleen (andi at firstfloor.org) wrote:

> 
> Hi,
> 
> Is there a way to do the following in systemd?
> 
> Run a program from the command line in a new cgroup container.
> After running output all the statistics accounted by cgroups,
> like CPU time, IO bytes, max memory usage etc.
> 
> Essentially like time(1), just using cgroups: systemd-time.
> time does a lot of what I need, but not everything.

We currently lack any nice APIs to read accounting data from cgroups
currently, let alone have a CLI for this.

systemd-run is useful for unning things in cgroups, but it won't do
accounting for you. Not that accounting was really hard the kernel
exports enough for us already, but the question is how to get the API
right. For something frequently done such as reading accounting data we
need to come up with an API that doesn't involve D-Bus but can go
directly do cgroupfs/disk. And then, the question is whether we
shouldn't integrate this all with some kind of history scheme, but then
we enter PCP and RRD territory and that makes me careful.

You could put together something manually using something like the
"systemd-run" tool, and then read the accounting data off the cgroup
that was created that way.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list