Skip to content

Commit

Permalink
Reduce compilation time of the QC project (#219)
Browse files Browse the repository at this point in the history
* Framework - delete unnecessary headers, add needed, correct inclusion type

* Forward declarations and moving stuff inside .cxx files

* more forward declarations and Framework tests clean up

* cleanups in Modules

* use default ctors and dtors wherever possible

* some additional (hopefully) improvements

* Formatting
  • Loading branch information
knopers8 authored Aug 7, 2019
1 parent d051de2 commit 86a002d
Show file tree
Hide file tree
Showing 93 changed files with 389 additions and 380 deletions.
1 change: 1 addition & 0 deletions Framework/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ add_library(QualityControl
src/CcdbDatabase.cxx
src/InformationService.cxx
src/InformationServiceDump.cxx
src/TaskFactory.cxx
src/TaskRunner.cxx
src/TaskRunnerFactory.cxx
src/TaskInterface.cxx
Expand Down
7 changes: 4 additions & 3 deletions Framework/include/QualityControl/CcdbDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
#ifndef QC_REPOSITORY_CCDBDATABASE_H
#define QC_REPOSITORY_CCDBDATABASE_H

#include "CCDB/CcdbApi.h"
#include <CCDB/CcdbApi.h>

#include "QualityControl/DatabaseInterface.h"

namespace o2::quality_control::repository
Expand Down Expand Up @@ -49,7 +50,7 @@ namespace o2::quality_control::repository
class CcdbDatabase : public DatabaseInterface
{
public:
CcdbDatabase();
CcdbDatabase() = default;
virtual ~CcdbDatabase();

void connect(std::string host, std::string database, std::string username, std::string password) override;
Expand Down Expand Up @@ -84,7 +85,7 @@ class CcdbDatabase : public DatabaseInterface
*/
std::string getListing(std::string subpath = "", std::string accept = "text/plain");
o2::ccdb::CcdbApi ccdbApi;
std::string mUrl;
std::string mUrl = "";
};

} // namespace o2::quality_control::repository
Expand Down
4 changes: 4 additions & 0 deletions Framework/include/QualityControl/CheckInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
#ifndef QC_CHECKER_CHECKINTERFACE_H
#define QC_CHECKER_CHECKINTERFACE_H

#include <string>

#include <Rtypes.h>

#include "QualityControl/MonitorObject.h"
#include "QualityControl/Quality.h"

Expand Down
20 changes: 18 additions & 2 deletions Framework/include/QualityControl/Checker.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,33 @@
// std & boost
#include <chrono>
#include <memory>
#include <string>
#include <map>
#include <vector>
// O2
#include <Common/Timer.h>
#include <Configuration/ConfigurationInterface.h>
#include <Framework/Task.h>
#include <Monitoring/MonitoringFactory.h>
#include <Headers/DataHeader.h>
// QC
#include "QualityControl/CheckInterface.h"
#include "QualityControl/DatabaseInterface.h"
#include "QualityControl/MonitorObject.h"
#include "QualityControl/QcInfoLogger.h"

namespace o2::framework
{
struct InputSpec;
struct OutputSpec;
class DataAllocator;
} // namespace o2::framework

namespace o2::monitoring
{
class Monitoring;
}

class TClass;

namespace o2::quality_control::checker
{

Expand Down
7 changes: 6 additions & 1 deletion Framework/include/QualityControl/CheckerFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@
#ifndef QC_CHECKERFACTORY_H
#define QC_CHECKERFACTORY_H

#include "Framework/DataProcessorSpec.h"
#include <string>

namespace o2::framework
{
struct DataProcessorSpec;
}

namespace o2::quality_control::checker
{
Expand Down
4 changes: 3 additions & 1 deletion Framework/include/QualityControl/DataDumpGui.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
#ifndef QC_CORE_DATADUMP_H
#define QC_CORE_DATADUMP_H

#include "FairMQDevice.h"
#include <string>

#include <fairmq/FairMQDevice.h>

namespace o2::quality_control::core
{
Expand Down
2 changes: 0 additions & 2 deletions Framework/include/QualityControl/DatabaseFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
#define QC_REPOSITORY_DATABASEFACTORY_H

#include <memory>
// O2
#include "Common/Exceptions.h"
// QC
#include "QualityControl/DatabaseInterface.h"

Expand Down
10 changes: 6 additions & 4 deletions Framework/include/QualityControl/DatabaseInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,12 @@
#ifndef QC_REPOSITORY_DATABASEINTERFACE_H
#define QC_REPOSITORY_DATABASEINTERFACE_H

#include "QualityControl/MonitorObject.h"
#include <string>
#include <memory>
#include <vector>
#include <unordered_map>
//#include <bits/unique_ptr.h>

#include "QualityControl/MonitorObject.h"

namespace o2::quality_control::repository
{
Expand All @@ -31,9 +33,9 @@ class DatabaseInterface
{
public:
/// Default constructor
DatabaseInterface() {}
DatabaseInterface() = default;
/// Destructor
virtual ~DatabaseInterface() {}
virtual ~DatabaseInterface() = default;

/**
* Connects to the database.
Expand Down
11 changes: 11 additions & 0 deletions Framework/include/QualityControl/ExamplePrinterSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@
#ifndef QUALITYCONTROL_EXAMPLEPRINTERSPEC_H
#define QUALITYCONTROL_EXAMPLEPRINTERSPEC_H

#include <string>
#include <memory>

#include <TH1F.h>
#include <TObjArray.h>

#include <Framework/Task.h>
#include <Framework/DataRefUtils.h>

#include "QualityControl/MonitorObject.h"

namespace o2::quality_control::example
{

Expand Down
14 changes: 11 additions & 3 deletions Framework/include/QualityControl/HistoMerger.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,21 @@
#ifndef QC_CORE_HISTOMERGER_H
#define QC_CORE_HISTOMERGER_H

#include <memory>
#include <string>
#include <vector>

#include "Common/Timer.h"
#include <Common/Timer.h>
#include <Framework/Task.h>
#include <Headers/DataHeader.h>
#include <TH1.h>

namespace o2::framework
{
struct InputSpec;
struct OutputSpec;
} // namespace o2::framework

class TH1;
class TObjArray;

#include "QualityControl/MonitorObject.h"

Expand Down
7 changes: 6 additions & 1 deletion Framework/include/QualityControl/InfrastructureGenerator.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
#ifndef QC_CORE_INFRASTRUCTUREGENERATOR_H
#define QC_CORE_INFRASTRUCTUREGENERATOR_H

#include <vector>
#include <string>

namespace o2::framework
{
struct CompletionPolicy;
}
#include <Framework/WorkflowSpec.h>
#include <Framework/CompletionPolicy.h>

namespace o2::quality_control
{
Expand Down
3 changes: 2 additions & 1 deletion Framework/include/QualityControl/MonitorObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
#define QC_CORE_MONITOROBJECT_H

// std
#include <iostream>
#include <string>
#include <map>
// ROOT
#include <Rtypes.h>
#include <TObject.h>
// O2
#include <Common/Exceptions.h>
Expand Down
5 changes: 3 additions & 2 deletions Framework/include/QualityControl/MySqlDatabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@
#ifndef QC_REPOSITORY_MYSQLDATABASE_H
#define QC_REPOSITORY_MYSQLDATABASE_H

#include "Common/Timer.h"
#include <Common/Timer.h>

#include "QualityControl/DatabaseInterface.h"
#include "TMySQLServer.h"

class TMySQLResult;
class TMySQLServer;

namespace o2::quality_control::repository
{
Expand Down
23 changes: 9 additions & 14 deletions Framework/include/QualityControl/ObjectsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,18 @@
#include "QualityControl/MonitorObject.h"
#include "QualityControl/Quality.h"
#include "QualityControl/TaskConfig.h"
#include "QualityControl/ServiceDiscovery.h"
// ROOT
#include <TObjArray.h>
#include <TObjString.h>
// boost
#include <boost/concept_check.hpp>
// stl
#include <string>
#include <memory>

class TObject;
class TObjArray;

namespace o2::quality_control::core
{

class ServiceDiscovery;

/// \brief Keeps the list of encapsulated objects to publish and does the actual publication.
///
/// Keeps a list of the objects to publish, encapsulates them and does the actual publication.
Expand All @@ -40,10 +40,8 @@ namespace o2::quality_control::core
/// \author Barthelemy von Haller
class ObjectsManager
{
friend class TaskControl; // TaskControl must be able to call "publish()" whenever needed. Nobody else can.

public:
ObjectsManager(TaskConfig& taskConfig);
explicit ObjectsManager(TaskConfig& taskConfig);
virtual ~ObjectsManager();

/**
Expand Down Expand Up @@ -92,10 +90,7 @@ class ObjectsManager

TObject* getObject(std::string objectName);

TObjArray* getNonOwningArray() const
{
return new TObjArray(mMonitorObjects);
};
TObjArray* getNonOwningArray() const;

/**
* \brief Add metadata to a MonitorObject.
Expand All @@ -119,7 +114,7 @@ class ObjectsManager
void updateServiceDiscovery();

private:
TObjArray mMonitorObjects;
std::unique_ptr<TObjArray> mMonitorObjects;
TaskConfig& mTaskConfig;
std::unique_ptr<ServiceDiscovery> mServiceDiscovery;
bool mUpdateServiceDiscovery;
Expand Down
5 changes: 2 additions & 3 deletions Framework/include/QualityControl/QcInfoLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@
#ifndef QC_CORE_QCINFOLOGGER_H
#define QC_CORE_QCINFOLOGGER_H

#include "TaskInterface.h"
#include <InfoLogger/InfoLogger.hxx>
#include <iostream>
#include "QualityControl/TaskInterface.h"

typedef AliceO2::InfoLogger::InfoLogger infologger; // not to have to type the full stuff each time -> log::endm

Expand Down Expand Up @@ -51,7 +50,7 @@ class QcInfoLogger : public AliceO2::InfoLogger::InfoLogger
*this << "QC infologger initialized" << infologger::endm;
}

~QcInfoLogger() override {}
~QcInfoLogger() override = default;

// Disallow copying
QcInfoLogger& operator=(const QcInfoLogger&) = delete;
Expand Down
11 changes: 3 additions & 8 deletions Framework/include/QualityControl/Quality.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
#ifndef QC_CORE_QUALITY_H
#define QC_CORE_QUALITY_H

#include <TObject.h>
#include <ostream>
#include <Rtypes.h>
#include <string>

namespace o2::quality_control::core
Expand All @@ -33,7 +32,7 @@ class Quality
/// Not 'explicit', we allow implicit conversion from uint to Quality.
explicit Quality(unsigned int level = Quality::NullLevel, std::string name = "");
/// Destructor
virtual ~Quality();
virtual ~Quality() = default;

unsigned int getLevel() const;
const std::string& getName() const;
Expand All @@ -49,11 +48,7 @@ class Quality
return (lhs.getName() == rhs.getName() && lhs.getLevel() == rhs.getLevel());
}
friend bool operator!=(const Quality& lhs, const Quality& rhs) { return !operator==(lhs, rhs); }
friend std::ostream& operator<<(std::ostream& out, const Quality& q) // output
{
out << "Quality: " << q.getName() << " (level " << q.getLevel() << ")\n";
return out;
}
friend std::ostream& operator<<(std::ostream& out, const Quality& q); // output

/**
* \brief Checks whether this quality object is worst than another one.
Expand Down
4 changes: 2 additions & 2 deletions Framework/include/QualityControl/TaskConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#define QC_CORE_TASKCONFIG_H

#include <string>
#include <Configuration/ConfigurationInterface.h>
#include <unordered_map>

namespace o2::quality_control::core
{
Expand All @@ -30,7 +30,7 @@ struct TaskConfig {
int cycleDurationSeconds;
int maxNumberCycles;
std::string consulUrl;
o2::configuration::KeyValueMap customParameters = {};
std::unordered_map<std::string, std::string> customParameters = {};
};

} // namespace o2::quality_control::core
Expand Down
Loading

0 comments on commit 86a002d

Please sign in to comment.