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> |
20 | typedef struct rusage Rusage; |
21 | #endif |
22 | |
23 | mal_export int malProfileMode; |
24 | |
25 | mal_export void initProfiler(void); |
26 | mal_export str openProfilerStream(Client cntxt); |
27 | mal_export str closeProfilerStream(Client cntxt); |
28 | |
29 | mal_export void profilerEvent(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci, int start); |
30 | mal_export void sqlProfilerEvent(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); |
31 | |
32 | mal_export str startProfiler(Client cntxt); |
33 | mal_export str stopProfiler(Client cntxt); |
34 | mal_export str startTrace(Client cntxt); |
35 | mal_export str stopTrace(Client cntxt); |
36 | mal_export void setHeartbeat(int delay); |
37 | mal_export void initHeartbeat(void); |
38 | mal_export void profilerHeartbeatEvent(char *alter); |
39 | mal_export int getprofilerlimit(void); |
40 | mal_export void setprofilerlimit(int limit); |
41 | |
42 | mal_export void MPresetProfiler(stream *fdout); |
43 | |
44 | mal_export void clearTrace(Client cntxt); |
45 | mal_export int TRACEtable(Client cntxt, BAT **r); |
46 | mal_export str cleanupTraces(Client cntxt); |
47 | mal_export BAT *getTrace(Client cntxt, const char *nme); |
48 | |
49 | |
50 | mal_export lng getDiskSpace(void); |
51 | mal_export lng getDiskReads(void); |
52 | mal_export lng getDiskWrites(void); |
53 | mal_export lng getUserTime(void); |
54 | mal_export lng getSystemTime(void); |
55 | mal_export void profilerGetCPUStat(lng *user, lng *nice, lng *sys, lng *idle, lng *iowait); |
56 | #endif |
57 | |