1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
2 | // |
3 | // SPDX-License-Identifier: GPL-3.0-or-later |
4 | |
5 | #ifndef PERFFLAMEGRAPHSCRIPT_H |
6 | #define PERFFLAMEGRAPHSCRIPT_H |
7 | |
8 | #include "common/common.h" |
9 | |
10 | #include <QString> |
11 | |
12 | #include <functional> |
13 | |
14 | typedef QProcess Task; |
15 | |
16 | class PerfRecord : public Task |
17 | { |
18 | Q_OBJECT |
19 | public: |
20 | PerfRecord(const QString &outFile); |
21 | void setAttachPid(uint pid); |
22 | private: |
23 | uint pid; |
24 | QString ouFile; |
25 | }; |
26 | |
27 | class PerfScript : public Task |
28 | { |
29 | Q_OBJECT |
30 | public: |
31 | PerfScript(const QString &perfRecordOutFileIn, const QString &outFile); |
32 | }; |
33 | |
34 | class StackCollapse : public Task |
35 | { |
36 | Q_OBJECT |
37 | public: |
38 | StackCollapse(const QString &perfScriptOutFile, const QString &outFile); |
39 | }; |
40 | |
41 | // out file is svg fromat |
42 | class FlameGraph : public Task |
43 | { |
44 | Q_OBJECT |
45 | public: |
46 | FlameGraph(const QString &stackCollapseOutFile, const QString &outFile); |
47 | }; |
48 | |
49 | class FlameGraphGenTaskPrivate; |
50 | class FlameGraphGenTask : public QObject |
51 | { |
52 | Q_OBJECT |
53 | FlameGraphGenTaskPrivate *const d; |
54 | public: |
55 | explicit FlameGraphGenTask(QObject *parent = nullptr); |
56 | virtual ~FlameGraphGenTask(); |
57 | void showWebBrowser(bool flag); |
58 | void start(uint pid); |
59 | void stop(); |
60 | |
61 | signals: |
62 | void started(); |
63 | void error(const QString &err); |
64 | void showed(const QString svgFile); |
65 | }; |
66 | |
67 | #endif // PERFFLAMEGRAPHSCRIPT_H |
68 | |