chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6a9bff4
)
selinux: also profile memory usage
author
Lennart Poettering
<lennart@poettering.net>
Wed, 27 Jul 2011 19:47:25 +0000
(21:47 +0200)
committer
Lennart Poettering
<lennart@poettering.net>
Wed, 27 Jul 2011 19:47:25 +0000
(21:47 +0200)
src/label.c
patch
|
blob
|
history
diff --git
a/src/label.c
b/src/label.c
index 5157b790d284de06a50306d1216c7c31999edb12..b7bb03322fbc49693d8d7069a66ba523833ec862 100644
(file)
--- a/
src/label.c
+++ b/
src/label.c
@@
-22,6
+22,7
@@
#include <errno.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>
#include <sys/stat.h>
#include <unistd.h>
+#include <malloc.h>
#include "label.h"
#include "util.h"
#include "label.h"
#include "util.h"
@@
-48,6
+49,7
@@
int label_init(void) {
#ifdef HAVE_SELINUX
usec_t n;
#ifdef HAVE_SELINUX
usec_t n;
+ struct mallinfo before;
if (!use_selinux())
return 0;
if (!use_selinux())
return 0;
@@
-55,7
+57,9
@@
int label_init(void) {
if (label_hnd)
return 0;
if (label_hnd)
return 0;
+ before = mallinfo();
n = now(CLOCK_MONOTONIC);
n = now(CLOCK_MONOTONIC);
+
label_hnd = selabel_open(SELABEL_CTX_FILE, NULL, 0);
if (!label_hnd) {
log_full(security_getenforce() == 1 ? LOG_ERR : LOG_DEBUG,
label_hnd = selabel_open(SELABEL_CTX_FILE, NULL, 0);
if (!label_hnd) {
log_full(security_getenforce() == 1 ? LOG_ERR : LOG_DEBUG,
@@
-63,12
+67,18
@@
int label_init(void) {
r = security_getenforce() == 1 ? -errno : 0;
} else {
char buf[FORMAT_TIMESPAN_MAX];
r = security_getenforce() == 1 ? -errno : 0;
} else {
char buf[FORMAT_TIMESPAN_MAX];
+ struct mallinfo after;
+ int l;
n = now(CLOCK_MONOTONIC) - n;
n = now(CLOCK_MONOTONIC) - n;
- log_info("Successfully loaded SELinux database in %s.",
- format_timespan(buf, sizeof(buf), n));
- }
+ after = mallinfo();
+ l = after.uordblks > before.uordblks ? after.uordblks - before.uordblks : 0;
+
+ log_info("Successfully loaded SELinux database in %s, size on heap is %iK.",
+ format_timespan(buf, sizeof(buf), n),
+ l/1024);
+ }
#endif
return r;
#endif
return r;