summaryrefslogtreecommitdiffstats
path: root/lpsm_alloc_stats.3.in
blob: eb7477b41d0403d6c3a66894cd9e0c87b4bc8d84 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
.\" -*- nroff -*- ---------------------------------------------------------
.\"   
.\"   Copyright 2001-2008 H. Peter Anvin - All Rights Reserved
.\"
.\"   This program is free software; you can redistribute it and/or modify
.\"   it under the terms of the GNU Lesser General Public License as
.\"   published by the Free Software Foundation, Inc.,
.\"   59 Temple Place Ste 330, Bostom MA 02111-1307, USA; version 2.1,
.\"   incorporated herein by reference.
.\"
.\" -----------------------------------------------------------------------
.TH LPSM_ALLOC_STATS 3  "22 October 2001" "LPSM @@VERSION@@" "Linux Persistent Memory"
.SH NAME
lpsm_alloc_stats \- Get persistent memory allocation statistics
.SH SYNOPSIS
.nf
.B #include <lpsm.h>
.sp
.BI "struct lpsm_alloc_stats *lpsm_alloc_stats(void);"
.nl
.fi
.SH DESCRIPTION
.B lpsm_alloc_stats()
return allocation statistics for persistent memory allocated with
.B lpsm_malloc()
and its associated functions.  A persistent memory arena needs to be
initialized via
.B lpsm_init()
before this function can be called.
.SH "RETURN VALUES"
.B lpsm_alloc_stats()
returns a pointer to an array of
.IR "struct lpsm_alloc_stats" ,
defined as:
.RS
.sp
.nf
struct lpsm_alloc_stats {
	size_t \fIsize\fP;
	size_t \fIfree\fP;
	size_t \fIalloc\fP;
};
.fi
.sp
.RE
Each entry in this array indicates the size of a particular memory
block class, in bytes, and the number of blocks of each class
currently available and currently allocated.  The list is terminated
by an entry with
.I size
set to zero.
.PP
This list is allocated (with
.BR malloc() )
in conventional (transient) memory; it is the responsibity of the
application to free this memory.
.PP
On failure,
.B lpsm_alloc_stats()
returns
.B NULL
and
.I errno
is set to
.BR ENOMEM .
.SH "NOTES"
.B lpsm_alloc_stats()
can be a very heavyweight operation.
.SH "SEE ALSO"
.BR lpsm_alloc_size (3),
.BR lpsm_malloc (3),
.BR malloc (3),
.BR lpsm (7).