Skip to content

Commit

Permalink
finish documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
juangpc committed May 24, 2021
1 parent ef91791 commit 1959b7a
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 23 deletions.
7 changes: 1 addition & 6 deletions applications/mne_scan/mne_scan/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@

using namespace SCMEASLIB;
using namespace MNESCAN;
using namespace Eigen;
//using namespace UTILSLIB;
//using namespace Eigen;

//=============================================================================================================
// GLOBAL DEFINTIONS
Expand Down Expand Up @@ -152,8 +151,6 @@ int main(int argc, char *argv[])
#endif
#endif

MNE_TRACER_ENABLE(file_test.json)

qInstallMessageHandler(UTILSLIB::ApplicationLogger::customLogWriter);
QApplication app(argc, argv);
//app.setAttribute(Qt::AA_DontCreateNativeWidgetSiblings, true);
Expand All @@ -180,7 +177,5 @@ int main(int argc, char *argv[])

int returnValue(app.exec());

MNE_TRACER_DISABLE

return returnValue;
}
9 changes: 4 additions & 5 deletions applications/mne_scan/mne_scan/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ MainWindow::MainWindow(QWidget *parent)
, m_sSettingsPath("MNESCAN/MainWindow")
, m_sCurrentStyle("default")
{
MNE_TRACE()
fprintf(stderr, "%s - Version %s\n",
CInfo::AppNameShort().toUtf8().constData(),
CInfo::AppVersion().toUtf8().constData());
Expand Down Expand Up @@ -135,7 +134,7 @@ MainWindow::MainWindow(QWidget *parent)

MainWindow::~MainWindow()
{
MNE_TRACE()

saveSettings();

if(m_bIsRunning) {
Expand Down Expand Up @@ -163,7 +162,7 @@ void MainWindow::setupPlugins()

void MainWindow::setupUI()
{
MNE_TRACE()

// Quick control selection
m_pQuickControlView = new QuickControlView(QString("MNESCAN/MainWindow/QuickControl"),
"MNE Scan",
Expand All @@ -182,7 +181,7 @@ void MainWindow::setupUI()

void MainWindow::saveSettings()
{
MNE_TRACE()

if(m_sSettingsPath.isEmpty()) {
return;
}
Expand Down Expand Up @@ -218,7 +217,7 @@ void MainWindow::loadSettings()

void MainWindow::onStyleChanged(const QString& sStyle)
{
MNE_TRACE()

qInfo() << "MainWindow::onStyleChanged";
qInfo() << "MainWindow::onStyleChanged sStyle" << sStyle;
if(QApplication *pApp = qobject_cast<QApplication *>(QApplication::instance())) {
Expand Down
4 changes: 2 additions & 2 deletions applications/mne_scan/mne_scan/pluginscene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ PluginScene::PluginScene(QMenu *pMenuPluginItem, PluginGui *pPluginGui)
, m_pActionPluginItem(Q_NULLPTR)
, leftButtonDown(false)
{
MNE_TRACE()

m_pMenuPluginItem = pMenuPluginItem;
m_mode = MovePluginItem;
// m_itemType = PluginItem::Sensor;
Expand All @@ -80,7 +80,7 @@ PluginScene::~PluginScene()

void PluginScene::insertItem(const QPointF& pos)
{
MNE_TRACE()

PluginItem *item;
SCSHAREDLIB::AbstractPlugin::SPtr pPlugin;
QString name;
Expand Down
10 changes: 5 additions & 5 deletions libraries/utils/mnetracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ MNETracer::MNETracer(const std::string &file, const std::string &function, int l
, m_iEndTime(0)
, m_dDurationMilis(0.)
{
initialize();
if (ms_bIsEnabled && m_bIsInitialized)
if (ms_bIsEnabled)
{
initialize();
writeBeginEvent();
}
}
Expand Down Expand Up @@ -114,10 +114,10 @@ void MNETracer::traceQuantity(const std::string &name, long val)

void MNETracer::initialize()
{
registerConstructionTime();
registerThreadId();
formatFileName();
// formatFunctionName();
registerThreadId();
registerInitialTime();
m_bIsInitialized = true;
}

Expand All @@ -130,7 +130,7 @@ void MNETracer::setZeroTime()

//=============================================================================================================

void MNETracer::registerInitialTime()
void MNETracer::registerConstructionTime()
{
m_iBeginTime = getTimeNow() - ms_iZeroTime;
}
Expand Down
43 changes: 40 additions & 3 deletions libraries/utils/mnetracer.h
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ namespace UTILSLIB
* variables shared and accessible from all the instances of this class MNETracer. Each instance, in its contructor will
* record the creation time and write to file that begin-measurement event.
* Whenever the MNETracer object is destructued (normally by falling out of scope), the destructor of this class MNETracer will
* be called and it is in the desctructor where the end-measurement event is recorded and written to file.
* be called and it is in the desctructor where the end-measurement event is recorded and written to file. So the time-alive (time
* between the constructor and the desctructor calls, for objects of this class, will be linked to a specific scope (i.e. function).
*
* Since this class is oriented as a development tool, all the events are written to the output file stream directly, so there
* should be not much difficulty recovering the results even if the application crashed.
Expand Down Expand Up @@ -222,18 +223,54 @@ class UTILSSHARED_EXPORT MNETracer
static long long getTimeNow();

/**
* @brief initialize
* @brief initialize Formats the fileName, FunctionName and line of code text shown in each event saved to the output file.
* It then registers the threadId and the construction time for each instance of the class.
*/
void initialize();

/**
* Removes extra back-slashes from the filename string.
*/
void formatFileName();

/**
* removes "__cdecl" from the function name.
*/
void formatFunctionName();
void registerInitialTime();

/**
* Saves the construction time of this object. To later compute the time between construction and destruction of each object.
*/
void registerConstructionTime();

/**
* Saves the destruction time of this object. See registerConstructionTime.
*/
void registerFinalTime();

/**
* Stores a string, definiing a specific thread based on a hashing function. The same thread will always have the same stringId.
*/
void registerThreadId();

/**
* Calculate duration between construction and destruction of an object.
*/
void calculateDuration();

/**
* Print duration in miliseconds.
*/
void printDurationMiliSec();

/**
* Write an event of type B (begin) in the output file.
*/
void writeBeginEvent();

/**
* Write an event of type E (end) in the ouptut file.
*/
void writeEndEvent();

static bool ms_bIsEnabled; /**< Bool variable to store if the "class" (ie. the MNETracer) has been enabled. */
Expand Down
1 change: 0 additions & 1 deletion libraries/utils/spectrogram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ MatrixXd Spectrogram::makeSpectrogram(VectorXd signal, qint32 windowSize = 0)

VectorXd Spectrogram::gaussWindow(qint32 sample_count, qreal scale, quint32 translation)
{
MNE_TRACE()
VectorXd gauss = VectorXd::Zero(sample_count);

for(qint32 n = 0; n < sample_count; n++)
Expand Down
2 changes: 1 addition & 1 deletion mne-cpp.pri
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ QMAKE_TARGET_COPYRIGHT = Copyright (C) 2020 Authors of MNE-CPP. All rights reser


# Default flags
MNECPP_CONFIG += trace
MNECPP_CONFIG +=

# Define c++ version
CONFIG += c++14
Expand Down

0 comments on commit 1959b7a

Please sign in to comment.