comparison probes/tests/memory.c @ 9:6f2e13f5fcfd

Add the memory probe
author Louis Opter <louis@dotcloud.com>
date Sun, 02 Jan 2011 01:50:27 +0100
parents
children 3a1977ecccc7
comparison
equal deleted inserted replaced
8:fe254ba0818d 9:6f2e13f5fcfd
1 #include <sys/types.h>
2
3 #include <err.h>
4 #include <stdlib.h>
5 #include <stdio.h>
6
7 #include "lxcstats.h"
8 #include "_lxcstats.h"
9 #include "probes/probes.h"
10
11 int
12 main(void)
13 {
14 lxcst_handle *hdl;
15 struct lxcst *c;
16
17 hdl = lxcst_open();
18 if (!hdl)
19 err(EXIT_FAILURE, "lxcst_open failed");
20
21 c = _lxcst_container_new(hdl, ".");
22 if (!c)
23 err(EXIT_FAILURE, "cant create container");
24
25 if (_lxcst_probe_memory(c))
26 err(EXIT_FAILURE, "probe cpuacct failed");
27
28 printf("used %ju\nmapped %ju\ncached %ju\nswapped %ju\n",
29 c->memory.used, c->memory.mapped, c->memory.cached, c->memory.swapped);
30
31 _lxcst_container_delete(c);
32
33 lxcst_close(hdl);
34
35 return (EXIT_SUCCESS);
36 }