yse / easy_profiler

Lightweight profiler library for c++
MIT License
2.19k stars 189 forks source link

Remote application control #88

Open ludekvodicka opened 6 years ago

ludekvodicka commented 6 years ago

Hi,

is there any way to configure listening port + run Connect action + run Capture action via command line or by any remote command?

I have EasyProfiler integrated into my testing system and would be great to be able to run benchmarks with profiling with the single click from my application.

Run tracking could be possible via command line params, stop would be a little trickier but it could be done too.

I quickly checked the source and I think there is currently no such feature. Are there any plans for this? If not but there would be interest I can try to implement it and post PR.

cas4ey commented 6 years ago

Hi @ludekvodicka

Do you mean automatically connect+capture for GUI? GUI could be connected to the application which is already profiling and it will automatically show capture dialog window after connect.

However, there is no possibility to configure address + port + connect-action via command line arguments for GUI. If you want to implement or already implemented this feature - PR is totally welcome :+1:

ludekvodicka commented 6 years ago

Can I ask how to automatically connect+capture?

cas4ey commented 6 years ago

There is parsing of arguments in EasyMainWindow constructor. Currently it treats first argument as file name to open. You should search for this code:

if(QCoreApplication::arguments().size() > 1)
{
    auto opened_filename = QCoreApplication::arguments().at(1);
    loadFile(opened_filename);
}

Here it is.

After parsing address and port from command line, you need to add next code into the end of constructor:

m_addressEdit->setText(<address value from command line>);
m_portEdit->setText(QString::number(<port value from command line>));
onConnectClicked(true);
if (EASY_GLOBALS.connected && m_listener.regime() == LISTENER_IDLE)
    onCaptureClicked(true);

More info about Qt QApplication arguments parsing: http://doc.qt.io/qt-5/qcoreapplication.html#accessing-command-line-arguments

cas4ey commented 6 years ago

@ludekvodicka is that ok that I have assigned this issue to you?

ludekvodicka commented 6 years ago

Sure, it's ok. But I can promise any term for implementation ;-). I will try it as soon as I will have some free time

ludekvodicka commented 4 years ago

Finally implemented ;-)

https://github.com/yse/easy_profiler/pull/173

Unfortunately, I wanted to do two separate PRs but both were merged to one.