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
14typedef QProcess Task;
15
16class PerfRecord : public Task
17{
18 Q_OBJECT
19public:
20 PerfRecord(const QString &outFile);
21 void setAttachPid(uint pid);
22private:
23 uint pid;
24 QString ouFile;
25};
26
27class PerfScript : public Task
28{
29 Q_OBJECT
30public:
31 PerfScript(const QString &perfRecordOutFileIn, const QString &outFile);
32};
33
34class StackCollapse : public Task
35{
36 Q_OBJECT
37public:
38 StackCollapse(const QString &perfScriptOutFile, const QString &outFile);
39};
40
41// out file is svg fromat
42class FlameGraph : public Task
43{
44 Q_OBJECT
45public:
46 FlameGraph(const QString &stackCollapseOutFile, const QString &outFile);
47};
48
49class FlameGraphGenTaskPrivate;
50class FlameGraphGenTask : public QObject
51{
52 Q_OBJECT
53 FlameGraphGenTaskPrivate *const d;
54public:
55 explicit FlameGraphGenTask(QObject *parent = nullptr);
56 virtual ~FlameGraphGenTask();
57 void showWebBrowser(bool flag);
58 void start(uint pid);
59 void stop();
60
61signals:
62 void started();
63 void error(const QString &err);
64 void showed(const QString svgFile);
65};
66
67#endif // PERFFLAMEGRAPHSCRIPT_H
68