summaryrefslogtreecommitdiffstats
path: root/lib/libpmc
diff options
context:
space:
mode:
authorfabient <fabient@FreeBSD.org>2011-10-18 15:25:43 +0000
committerfabient <fabient@FreeBSD.org>2011-10-18 15:25:43 +0000
commitc0da433b0a908c85fe0547ba8054795948e39d30 (patch)
tree3965b86bd8e0e5d008fd4219e7d38fa2351bfcac /lib/libpmc
parent9e1982ba8eaabe131f148406f3f2819d8e0e1563 (diff)
downloadFreeBSD-src-c0da433b0a908c85fe0547ba8054795948e39d30.zip
FreeBSD-src-c0da433b0a908c85fe0547ba8054795948e39d30.tar.gz
Add a flush of the current PMC log buffer before displaying the next top.
As the underlying block is 4KB if the PMC throughput is low the measurement will be reported on the next tick. pmcstat(8) use the modified flush API to reclaim current buffer before displaying next top. MFC after: 1 month
Diffstat (limited to 'lib/libpmc')
-rw-r--r--lib/libpmc/libpmc.c6
-rw-r--r--lib/libpmc/pmc.34
-rw-r--r--lib/libpmc/pmc.h1
-rw-r--r--lib/libpmc/pmc_configure_logfile.311
4 files changed, 21 insertions, 1 deletions
diff --git a/lib/libpmc/libpmc.c b/lib/libpmc/libpmc.c
index 1d86a82..f0d5b0c 100644
--- a/lib/libpmc/libpmc.c
+++ b/lib/libpmc/libpmc.c
@@ -2596,6 +2596,12 @@ pmc_flush_logfile(void)
}
int
+pmc_close_logfile(void)
+{
+ return (PMC_CALL(CLOSELOG,0));
+}
+
+int
pmc_get_driver_stats(struct pmc_driverstats *ds)
{
struct pmc_op_getdriverstats gms;
diff --git a/lib/libpmc/pmc.3 b/lib/libpmc/pmc.3
index 2403e64..2431080 100644
--- a/lib/libpmc/pmc.3
+++ b/lib/libpmc/pmc.3
@@ -322,6 +322,10 @@ to write logged events to.
Flush all pending log data in
.Xr hwpmc 4 Ns Ap s
buffers.
+.It Fn pmc_close_logfile
+Flush all pending log data and close
+.Xr hwpmc 4 Ns Ap s
+side of the stream.
.It Fn pmc_writelog
Append arbitrary user data to the current log file.
.El
diff --git a/lib/libpmc/pmc.h b/lib/libpmc/pmc.h
index 5b1ad07..2be88b1 100644
--- a/lib/libpmc/pmc.h
+++ b/lib/libpmc/pmc.h
@@ -76,6 +76,7 @@ int pmc_attach(pmc_id_t _pmcid, pid_t _pid);
int pmc_capabilities(pmc_id_t _pmc, uint32_t *_caps);
int pmc_configure_logfile(int _fd);
int pmc_flush_logfile(void);
+int pmc_close_logfile(void);
int pmc_detach(pmc_id_t _pmcid, pid_t _pid);
int pmc_disable(int _cpu, int _pmc);
int pmc_enable(int _cpu, int _pmc);
diff --git a/lib/libpmc/pmc_configure_logfile.3 b/lib/libpmc/pmc_configure_logfile.3
index a33688c..399f21a 100644
--- a/lib/libpmc/pmc_configure_logfile.3
+++ b/lib/libpmc/pmc_configure_logfile.3
@@ -29,7 +29,8 @@
.Sh NAME
.Nm pmc_configure_logfile ,
.Nm pmc_flush_logfile ,
-.Nm pmc_writelog
+.Nm pmc_writelog ,
+.Nm pmc_close_logfile
.Nd log file management
.Sh LIBRARY
.Lb libpmc
@@ -41,6 +42,8 @@
.Fn pmc_flush_logfile void
.Ft int
.Fn pmc_writelog "uint32_t userdata"
+.Ft int
+.Fn pmc_close_logfile void
.Sh DESCRIPTION
The functions manage logging of
.Xr hwpmc 4
@@ -72,6 +75,12 @@ Function
will append a log entry containing the value of argument
.Fa userdata
to the log file.
+.Pp
+Function
+.Fn pmc_close_logfile
+will flush all pending log data and close
+.Xr hwpmc 4 Ns Ap s
+side of the stream.
.Sh RETURN VALUES
.Rv -std
.Sh ERRORS
OpenPOWER on IntegriCloud