added wait profiler
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
8f5bb982cd
commit
748a644e2c
@ -49,6 +49,7 @@
|
|||||||
#include "pathmatcher/MultiMatcher.h"
|
#include "pathmatcher/MultiMatcher.h"
|
||||||
#include "pathmatcher/SimplePrefixMatcher.h"
|
#include "pathmatcher/SimplePrefixMatcher.h"
|
||||||
#include "settings/INIFile.h"
|
#include "settings/INIFile.h"
|
||||||
|
#include "tools/WaitProfiler.h"
|
||||||
#include "ui/InstanceWindow.h"
|
#include "ui/InstanceWindow.h"
|
||||||
#include "ui/MainWindow.h"
|
#include "ui/MainWindow.h"
|
||||||
|
|
||||||
@ -816,6 +817,7 @@ Application::Application(int& argc, char** argv) : QApplication(argc, argv)
|
|||||||
// FIXME: what to do with these?
|
// FIXME: what to do with these?
|
||||||
m_profilers.insert("jprofiler", std::shared_ptr<BaseProfilerFactory>(new JProfilerFactory()));
|
m_profilers.insert("jprofiler", std::shared_ptr<BaseProfilerFactory>(new JProfilerFactory()));
|
||||||
m_profilers.insert("jvisualvm", std::shared_ptr<BaseProfilerFactory>(new JVisualVMFactory()));
|
m_profilers.insert("jvisualvm", std::shared_ptr<BaseProfilerFactory>(new JVisualVMFactory()));
|
||||||
|
m_profilers.insert("waitprofiler", std::shared_ptr<BaseProfilerFactory>(new WaitProfilerFactory()));
|
||||||
for (auto profiler : m_profilers.values()) {
|
for (auto profiler : m_profilers.values()) {
|
||||||
profiler->registerSettings(m_settings);
|
profiler->registerSettings(m_settings);
|
||||||
}
|
}
|
||||||
|
@ -457,6 +457,8 @@ set(TOOLS_SOURCES
|
|||||||
tools/JVisualVM.h
|
tools/JVisualVM.h
|
||||||
tools/MCEditTool.cpp
|
tools/MCEditTool.cpp
|
||||||
tools/MCEditTool.h
|
tools/MCEditTool.h
|
||||||
|
tools/WaitProfiler.cpp
|
||||||
|
tools/WaitProfiler.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set(META_SOURCES
|
set(META_SOURCES
|
||||||
|
44
launcher/tools/WaitProfiler.cpp
Normal file
44
launcher/tools/WaitProfiler.cpp
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
/*
|
||||||
|
* Prism Launcher - Minecraft Launcher
|
||||||
|
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
|
||||||
|
*
|
||||||
|
* 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, version 3.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#include "WaitProfiler.h"
|
||||||
|
|
||||||
|
#include "BaseInstance.h"
|
||||||
|
#include "launch/LaunchTask.h"
|
||||||
|
#include "settings/SettingsObject.h"
|
||||||
|
|
||||||
|
class WaitProfiler : public BaseProfiler {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
WaitProfiler(SettingsObjectPtr settings, InstancePtr instance, QObject* parent = 0);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void beginProfilingImpl(shared_qobject_ptr<LaunchTask> process);
|
||||||
|
};
|
||||||
|
|
||||||
|
WaitProfiler::WaitProfiler(SettingsObjectPtr settings, InstancePtr instance, QObject* parent) : BaseProfiler(settings, instance, parent) {}
|
||||||
|
|
||||||
|
void WaitProfiler::beginProfilingImpl(shared_qobject_ptr<LaunchTask> process)
|
||||||
|
{
|
||||||
|
emit readyToLaunch(tr("Started process: %1").arg(process->pid()));
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseExternalTool* WaitProfilerFactory::createTool(InstancePtr instance, QObject* parent)
|
||||||
|
{
|
||||||
|
return new WaitProfiler(globalSettings, instance, parent);
|
||||||
|
}
|
||||||
|
#include "WaitProfiler.moc"
|
29
launcher/tools/WaitProfiler.h
Normal file
29
launcher/tools/WaitProfiler.h
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
/*
|
||||||
|
* Prism Launcher - Minecraft Launcher
|
||||||
|
* Copyright (c) 2023 Trial97 <alexandru.tripon97@gmail.com>
|
||||||
|
*
|
||||||
|
* 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, version 3.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "BaseProfiler.h"
|
||||||
|
|
||||||
|
class WaitProfilerFactory : public BaseProfilerFactory {
|
||||||
|
public:
|
||||||
|
QString name() const override { return "WaitProfiler"; }
|
||||||
|
void registerSettings(SettingsObjectPtr settings) override{};
|
||||||
|
BaseExternalTool* createTool(InstancePtr instance, QObject* parent = 0) override;
|
||||||
|
bool check(QString* error) override { return true; };
|
||||||
|
bool check(const QString& path, QString* error) override { return true; };
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user