Profiler support. Currently JProfiler and JVisualVM are implemented.

This commit is contained in:
Jan Dalheimer 2014-02-15 14:19:35 +01:00
parent 5cf599673d
commit efa8e26a3f
16 changed files with 505 additions and 17 deletions

View file

@ -31,6 +31,9 @@
#include "logic/updater/UpdateChecker.h"
#include "logic/updater/NotificationChecker.h"
#include "logic/profiler/JProfiler.h"
#include "logic/profiler/JVisualVM.h"
#include "pathutils.h"
#include "cmdutils.h"
#include <inisettingsobject.h>
@ -41,8 +44,9 @@
using namespace Util::Commandline;
MultiMC::MultiMC(int &argc, char **argv, bool root_override)
: QApplication(argc, argv), m_version{VERSION_MAJOR, VERSION_MINOR, VERSION_HOTFIX,
VERSION_BUILD, MultiMCVersion::VERSION_TYPE, VERSION_CHANNEL, BUILD_PLATFORM}
: QApplication(argc, argv),
m_version{VERSION_MAJOR, VERSION_MINOR, VERSION_HOTFIX, VERSION_BUILD,
MultiMCVersion::VERSION_TYPE, VERSION_CHANNEL, BUILD_PLATFORM}
{
setOrganizationName("MultiMC");
setApplicationName("MultiMC5");
@ -211,6 +215,15 @@ MultiMC::MultiMC(int &argc, char **argv, bool root_override)
// init proxy settings
updateProxySettings();
m_profilers.insert("jprofiler",
std::shared_ptr<BaseProfilerFactory>(new JProfilerFactory()));
m_profilers.insert("jvisualvm",
std::shared_ptr<BaseProfilerFactory>(new JVisualVMFactory()));
for (auto profiler : m_profilers.values())
{
profiler->registerSettings(m_settings.get());
}
// launch instance, if that's what should be done
// WARNING: disabled until further notice
/*
@ -426,6 +439,9 @@ void MultiMC::initGlobalSettings()
m_settings->registerSetting("ConsoleWindowGeometry", "");
m_settings->registerSetting("SettingsGeometry", "");
// Profilers
m_settings->registerSetting("CurrentProfiler");
}
void MultiMC::initHttpMetaCache()
@ -554,6 +570,11 @@ std::shared_ptr<JavaVersionList> MultiMC::javalist()
return m_javalist;
}
std::shared_ptr<BaseProfilerFactory> MultiMC::currentProfiler()
{
return m_profilers.value(m_settings->get("CurrentProfiler").toString());
}
void MultiMC::installUpdates(const QString updateFilesDir, UpdateFlags flags)
{
// if we are going to update on exit, save the params now