1/*
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 *
6 * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V.
7 */
8
9#ifndef _MAL_PROFILER_H
10#define _MAL_PROFILER_H
11
12#include "mal_client.h"
13
14#ifdef HAVE_SYS_TIMES_H
15# include <sys/times.h>
16#endif
17
18#ifdef HAVE_SYS_RESOURCE_H
19# include <sys/resource.h>
20typedef struct rusage Rusage;
21#endif
22
23mal_export int malProfileMode;
24
25mal_export void initProfiler(void);
26mal_export str openProfilerStream(Client cntxt);
27mal_export str closeProfilerStream(Client cntxt);
28
29mal_export void profilerEvent(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, int start);
30mal_export void sqlProfilerEvent(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci);
31
32mal_export str startProfiler(Client cntxt);
33mal_export str stopProfiler(Client cntxt);
34mal_export str startTrace(Client cntxt);
35mal_export str stopTrace(Client cntxt);
36mal_export void setHeartbeat(int delay);
37mal_export void initHeartbeat(void);
38mal_export void profilerHeartbeatEvent(char *alter);
39mal_export int getprofilerlimit(void);
40mal_export void setprofilerlimit(int limit);
41
42mal_export void MPresetProfiler(stream *fdout);
43
44mal_export void clearTrace(Client cntxt);
45mal_export int TRACEtable(Client cntxt, BAT **r);
46mal_export str cleanupTraces(Client cntxt);
47mal_export BAT *getTrace(Client cntxt, const char *nme);
48
49
50mal_export lng getDiskSpace(void);
51mal_export lng getDiskReads(void);
52mal_export lng getDiskWrites(void);
53mal_export lng getUserTime(void);
54mal_export lng getSystemTime(void);
55mal_export void profilerGetCPUStat(lng *user, lng *nice, lng *sys, lng *idle, lng *iowait);
56#endif
57