Server IP : 184.154.167.98 / Your IP : 18.218.113.187 Web Server : Apache System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : puertode ( 1767) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/pcp/demos/trace/ |
Upload File : |
/* * stub.c - libpcp_trace stubs * * Copyright (c) 1997 Silicon Graphics, Inc. All Rights Reserved. * * 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. */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <pcp/trace.h> int __pmstate = 0; int pmtracebegin(const char *tag) { #ifdef PMTRACE_DEBUG if (__pmstate & PMTRACE_STATE_API) fprintf(stderr, "pmtracebegin: start of transaction '%s'\n", tag); #endif return 0; } int pmtraceend(const char *tag) { #ifdef PMTRACE_DEBUG if (__pmstate & PMTRACE_STATE_API) fprintf(stderr, "pmtraceend: end of transaction '%s'\n", tag); #endif return 0; } int pmtraceabort(const char *tag) { #ifdef PMTRACE_DEBUG if (__pmstate & PMTRACE_STATE_API) fprintf(stderr, "pmtraceabort: transaction '%s' aborted\n", tag); #endif return 0; } int pmtraceobs(const char *label, double value) { #ifdef PMTRACE_DEBUG if (__pmstate & PMTRACE_STATE_API) fprintf(stderr, "pmtraceobs: observation '%s', value=%f\n", label, value); #endif return 0; } int pmtracecounter(const char *label, double value) { #ifdef PMTRACE_DEBUG if (__pmstate & PMTRACE_STATE_API) fprintf(stderr, "pmtracecounter: counter '%s', value=%f\n", label, value); #endif return 0; } int pmtracepoint(const char *label) { #ifdef PMTRACE_DEBUG if (__pmstate & PMTRACE_STATE_API) fprintf(stderr, "pmtracepoint: trace point '%s' reached\n", label); #endif return 0; } int pmtracestate(int code) { return(__pmstate |= code); } char * pmtraceerrstr(int code) { static const struct { int code; char *msg; } errtab[] = { { PMTRACE_ERR_TAGNAME, "Invalid tag name - tag names cannot be NULL" }, { PMTRACE_ERR_INPROGRESS, "Transaction is already in progress - cannot begin" }, { PMTRACE_ERR_NOPROGRESS, "Transaction is not currently in progress - cannot end" }, { PMTRACE_ERR_NOSUCHTAG, "Transaction tag was not successfully initialised" }, { PMTRACE_ERR_TAGTYPE, "Tag is already in use for a different type of tracing" }, { PMTRACE_ERR_TAGLENGTH, "Tag name is too long (maximum 256 characters)" }, { PMTRACE_ERR_IPC, "IPC protocol failure" }, { PMTRACE_ERR_ENVFORMAT, "Unrecognised environment variable format" }, { PMTRACE_ERR_TIMEOUT, "Application timed out connecting to the PMDA" }, { PMTRACE_ERR_VERSION, "Incompatible versions between application and PMDA" }, { PMTRACE_ERR_PERMISSION, "Cannot connect to PMDA - permission denied" }, { PMTRACE_ERR_CONNLIMIT, "Cannot connect to PMDA - connection limit reached" }, { 0, "" } }; if ((code < 0) && (code > -PMTRACE_ERR_BASE)) /* catch intro(2) errors */ return strerror(-code); else if (code == 0) return "No error"; else { int i; for (i=0; errtab[i].code; i++) { if (errtab[i].code == code) return errtab[i].msg; } } return "Unknown error code"; }