Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"version": 3,
"configurePresets": [
{
"name": "base",
"displayName": "base preset",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build-${presetName}",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": true
},
"hidden": true
},
{
"name": "dev",
"inherits": [
"base"
]
},
{
"name": "dev-clang",
"inherits": [
"base"
],
"cacheVariables": {
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++"
}
},
{
"name": "dev-qt5-clang",
"inherits": [
"base"
],
"cacheVariables": {
"CMAKE_C_COMPILER": "clang",
"CMAKE_CXX_COMPILER": "clang++"
}
}
]
}
20 changes: 14 additions & 6 deletions src/icecreammonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -190,30 +190,30 @@ bool IcecreamMonitor::handle_activity()
}

switch (ICECC_MSG_API_COMPAT(m->type, *m)) {
case ICECC_MSG_API_COMPAT(M_MON_GET_CS, Msg::GET_CS):
case ICECC_MSG_API_COMPAT(M_MON_GET_CS, Msg::MON_GET_CS):
handle_getcs(m.get());
break;
case ICECC_MSG_API_COMPAT(M_MON_JOB_BEGIN, Msg::JOB_BEGIN):
case ICECC_MSG_API_COMPAT(M_MON_JOB_BEGIN, Msg::MON_JOB_BEGIN):
handle_job_begin(m.get());
break;
case ICECC_MSG_API_COMPAT(M_MON_JOB_DONE, Msg::JOB_DONE):
case ICECC_MSG_API_COMPAT(M_MON_JOB_DONE, Msg::MON_JOB_DONE):
handle_job_done(m.get());
break;
case ICECC_MSG_API_COMPAT(M_END, Msg::END):
std::cout << "END" << endl;
checkScheduler(true);
break;
case ICECC_MSG_API_COMPAT(M_MON_STATS, Msg::STATS):
case ICECC_MSG_API_COMPAT(M_MON_STATS, Msg::MON_STATS):
handle_stats(m.get());
break;
case ICECC_MSG_API_COMPAT(M_MON_LOCAL_JOB_BEGIN, Msg::JOB_LOCAL_BEGIN):
case ICECC_MSG_API_COMPAT(M_MON_LOCAL_JOB_BEGIN, Msg::MON_LOCAL_JOB_BEGIN):
handle_local_begin(m.get());
break;
case ICECC_MSG_API_COMPAT(M_JOB_LOCAL_DONE, Msg::JOB_LOCAL_DONE):
handle_local_done(m.get());
break;
default:
cout << "UNKNOWN" << endl;
cout << "UNKNOWN message type " << ICECC_MSG_API_COMPAT(m->type, m->to_string()) << endl;
break;
}
return true;
Expand All @@ -222,9 +222,11 @@ bool IcecreamMonitor::handle_activity()
void IcecreamMonitor::handle_getcs(Msg *_m)
{
MonGetCSMsg *m = dynamic_cast<MonGetCSMsg *>(_m);
assert(m);
if (!m) {
return;
}

m_rememberedJobs[m->job_id] = Job(m->job_id, m->clientid,
QString::fromStdString(m->filename),
m->lang == CompileJob::Lang_C ?
Expand All @@ -237,6 +239,7 @@ void IcecreamMonitor::handle_getcs(Msg *_m)
void IcecreamMonitor::handle_local_begin(Msg *_m)
{
MonLocalJobBeginMsg *m = dynamic_cast<MonLocalJobBeginMsg *>(_m);
assert(m);
if (!m) {
return;
}
Expand All @@ -251,6 +254,7 @@ void IcecreamMonitor::handle_local_begin(Msg *_m)
void IcecreamMonitor::handle_local_done(Msg *_m)
{
JobLocalDoneMsg *m = dynamic_cast<JobLocalDoneMsg *>(_m);
assert(m);
if (!m) {
return;
}
Expand All @@ -275,6 +279,7 @@ void IcecreamMonitor::handle_local_done(Msg *_m)
void IcecreamMonitor::handle_stats(Msg *_m)
{
MonStatsMsg *m = dynamic_cast<MonStatsMsg *>(_m);
assert(m);
if (!m) {
return;
}
Expand Down Expand Up @@ -302,6 +307,7 @@ void IcecreamMonitor::handle_stats(Msg *_m)
void IcecreamMonitor::handle_job_begin(Msg *_m)
{
MonJobBeginMsg *m = dynamic_cast<MonJobBeginMsg *>(_m);
assert(m);
if (!m) {
return;
}
Expand All @@ -313,6 +319,7 @@ void IcecreamMonitor::handle_job_begin(Msg *_m)
}

HostInfo *hostInfo = hostInfoManager()->find(m->hostid);
assert(hostInfo);
if (hostInfo)
hostInfo->incJobs();

Expand All @@ -326,6 +333,7 @@ void IcecreamMonitor::handle_job_begin(Msg *_m)
void IcecreamMonitor::handle_job_done(Msg *_m)
{
MonJobDoneMsg *m = dynamic_cast<MonJobDoneMsg *>(_m);
assert(m);
if (!m) {
return;
}
Expand Down
21 changes: 4 additions & 17 deletions src/models/hostlistmodel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -213,25 +213,12 @@ void HostListModel::checkNode(unsigned int hostid)
}
}

struct find_hostid
: public std::unary_function<HostInfo, bool>
{
public:
explicit find_hostid(unsigned int hostId)
: m_hostId(hostId) {}

bool operator()(const HostInfo &info) const
{
return info.id() == m_hostId;
}

private:
unsigned int m_hostId;
};

void HostListModel::removeNodeById(unsigned int hostId)
{
QVector<HostInfo>::iterator it = std::find_if(m_hostInfos.begin(), m_hostInfos.end(), find_hostid(hostId));
auto it = std::find_if(m_hostInfos.begin(), m_hostInfos.end(),
[hostId](const HostInfo &info) {
return info.id() == hostId;
});
if (it == m_hostInfos.end()) {
return;
}
Expand Down
21 changes: 4 additions & 17 deletions src/models/joblistmodel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -263,22 +263,6 @@ int JobListModel::rowCount(const QModelIndex &parent) const
return m_jobs.size();
}

struct find_jobid
: public std::unary_function<Job, bool>
{
public:
explicit find_jobid(unsigned int jobId)
: m_jobId(jobId) {}

bool operator()(const Job &job) const
{
return job.id == m_jobId;
}

private:
unsigned int m_jobId;
};

void JobListModel::slotExpireFinishedJobs()
{
const uint currentTime = QDateTime::currentDateTime().toSecsSinceEpoch();
Expand Down Expand Up @@ -309,7 +293,10 @@ void JobListModel::removeItem(const Job &job)

void JobListModel::removeItemById(unsigned int jobId)
{
QVector<Job>::iterator it = std::find_if(m_jobs.begin(), m_jobs.end(), find_jobid(jobId));
QVector<Job>::iterator it = std::find_if(m_jobs.begin(), m_jobs.end(),
[jobId](const Job &job) {
return job.id == jobId;
});
int index = std::distance(m_jobs.begin(), it);
beginRemoveRows(QModelIndex(), index, index);
m_jobs.erase(it);
Expand Down