-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from umanwizard/capi
Introduce `capi` package.
- Loading branch information
Showing
12 changed files
with
486 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[package] | ||
name = "capi" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
name = "jemalloc_pprof" | ||
|
||
[dependencies] | ||
libc.workspace = true | ||
anyhow.workspace = true | ||
tempfile.workspace = true | ||
pure.path = "../pure" | ||
errno.workspace = true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#ifndef JEMALLOC_PPROF_H | ||
#define JEMALLOC_PPROF_H | ||
|
||
#include <stddef.h> | ||
|
||
#define JP_SUCCESS 0 | ||
#define JP_FAILURE 1 | ||
|
||
#ifdef __cplusplus | ||
extern "C" | ||
#endif | ||
int dump_jemalloc_pprof(char **buf_out, size_t *n_out); | ||
|
||
#endif // include guard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
.TH dump_jemalloc_pprof 3 "rust-jemalloc-pprof manual" | ||
.SH NAME | ||
dump_jemalloc_pprof \- dump the current jemalloc allocation profile in pprof format | ||
|
||
.SH SYNOPSIS | ||
\fB#include <jemalloc_pprof.h>\fR | ||
|
||
\fBint dump_jemalloc_pprof(\fR\fIunsigned char **buf_out, size_t *n_out\fR\fB);\fR | ||
|
||
.SH DESCRIPTION | ||
The \fBdump_jemalloc_pprof()\fR function is intended to be called from C code to dump the current jemalloc allocation profile in pprof format. It allocates a buffer and stores a pointer to this buffer in \fI*buf_out\fR. The size of the buffer is stored in \fI*n_out\fR. The function returns \fIJP_SUCCESS\fR if the operation succeeds or \fIJP_FAILURE\fR if it fails. In the case of failure, an error code may be stored in \fIerrno\fR if meaningful. | ||
|
||
If \fIJP_FAILURE\fR is returned, the values pointed to by \fIbuf_out\fR and \fIn_out\fR are unspecified. | ||
|
||
This function requires jemalloc profiling to be enabled and active. For more information, see \fBjemalloc(3)\fR. | ||
|
||
.SH SAFETY | ||
This function is marked as unsafe and should not be called directly from Rust code. A corresponding Rust API should be used instead. | ||
|
||
.SH "RETURN VALUES" | ||
.TP | ||
\fBJP_SUCCESS\fR | ||
Indicates that the operation succeeded. | ||
.TP | ||
\fBJP_FAILURE\fR | ||
Indicates that the operation failed. The specific error code can be found in \fIerrno\fR. | ||
|
||
.SH "SEE ALSO" | ||
\fBjemalloc(3)\fR, \fBerrno(3)\fR | ||
|
||
.SH AUTHOR | ||
This library was written by the Polar Signals team. See | ||
https://polarsignals.com for more information. |
Oops, something went wrong.