'\"macro stdmacro .\" .\" Copyright (c) 2010 Ken McDonell. All Rights Reserved. .\" Copyright (c) 2018,2026 Red Hat. .\" .\" This program is free software; you can redistribute it and/or modify it .\" under the terms of the GNU General Public License as published by the .\" Free Software Foundation; either version 2 of the License, or (at your .\" option) any later version. .\" .\" This program is distributed in the hope that it will be useful, but .\" WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY .\" or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License .\" for more details. .\" .\" .TH PMIWRITE 3 "" "Performance Co-Pilot" .SH NAME \f3pmiWrite\f1, \f3pmiWriteNow\f1 \- flush data to a LOGIMPORT archive .SH "C SYNOPSIS" .ft 3 .ad l .hy 0 #include .br #include .sp int pmiWrite(unsigned long long \fIsec\fP, unsigned int \fInsec\fP); .br int pmiWriteNow(void); .sp cc ... \-lpcp_import \-lpcp .hy .ad .ft 1 .SH "Perl SYNOPSIS" .ft 3 .ad l .hy 0 use PCP::LogImport; .sp pmiWrite($\fIsec\fP, $\fInsec\fP); .br pmiWriteNow(); .hy .ad .ft 1 .SH "Python SYNOPSIS" .ft 3 .ad l .hy 0 from pcp import pmi .sp log.pmiWrite(\fIsec\fP, \fInsec\fP) .hy .ad .ft 1 .SH DESCRIPTION As part of the Performance Co-Pilot Log Import API (see .BR LOGIMPORT (3)), these routines flush accumulated data values out to the PCP archive. .PP The data values and associated metadata have previously been built up using calls to .BR pmiAddMetric (3), .BR pmiAddInstance (3), .BR pmiPutValue (3) and .BR pmiPutValueHandle (3). .PP The current set of data values and any new metadata is written to the archive with the specified timestamp in the source timezone of the archive (see .BR pmiSetTimezone (3)). .PP .B pmiWrite accepts a nanosecond-resolution timestamp: seconds since the Unix epoch as a 64-bit unsigned integer .RI ( sec ) and nanoseconds within that second .RI ( nsec ). A .I sec value of zero writes a record with a Unix epoch timestamp (1970-01-01 00:00:00 UTC). .PP .B pmiWriteNow writes a record timestamped with the current wall-clock time. In Python, .B log.pmiWrite(0) (integer zero with no .I nsec argument) is equivalent to calling .BR pmiWriteNow . .SH DIAGNOSTICS Returns zero on success, else a negative value that can be turned into an error message by calling .BR pmiErrStr (3). .SH SEE ALSO .BR LOGIMPORT (3), .BR pmiAddInstance (3), .BR pmiAddMetric (3), .BR pmiErrStr (3), .BR pmiPutValue (3), .BR pmiPutValueHandle (3), .BR pmiPutText (3), .BR pmiPutLabel (3) and .BR pmiSetTimezone (3).