-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from sio2project/real-time-output
Real time output
- Loading branch information
Showing
9 changed files
with
113 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "RealTimeOIOutputBuilder.h" | ||
|
||
#include <sstream> | ||
|
||
namespace s2j { | ||
namespace printer { | ||
|
||
const std::string RealTimeOIOutputBuilder::FORMAT_NAME = "oireal"; | ||
|
||
std::string RealTimeOIOutputBuilder::dump() const { | ||
KillReason reason = killReason_; | ||
if (reason == KillReason::NONE) { | ||
if (killSignal_ > 0 || exitStatus_ > 0) { | ||
reason = KillReason::RE; | ||
} | ||
} | ||
|
||
std::stringstream ss; | ||
ss << killReasonName(reason) << " " << exitStatus_ << " " | ||
<< realMilliSecondsElapsed_ << " " | ||
<< 0ULL << " " << memoryPeakKb_ << " " | ||
<< syscallsCounter_ << std::endl; | ||
dumpStatus(ss); | ||
ss << std::endl; | ||
return ss.str(); | ||
} | ||
|
||
void RealTimeOIOutputBuilder::dumpStatus(std::ostream& ss) const { | ||
if (killReason_ != KillReason::NONE) { | ||
ss << killReasonComment_; | ||
} | ||
else if (killSignal_ > 0) { | ||
ss << "process exited due to signal " << killSignal_; | ||
} | ||
else if (exitStatus_ > 0) { | ||
ss << "runtime error " << exitStatus_; | ||
} | ||
else { | ||
ss << "ok"; | ||
} | ||
} | ||
|
||
} // namespace printer | ||
} // namespace s2j |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#pragma once | ||
|
||
#include "OIModelOutputBuilder.h" | ||
|
||
namespace s2j { | ||
namespace printer { | ||
|
||
class RealTimeOIOutputBuilder : public OIModelOutputBuilder { | ||
public: | ||
std::string dump() const override; | ||
|
||
const static std::string FORMAT_NAME; | ||
|
||
private: | ||
void dumpStatus(std::ostream& ss) const; | ||
int encodeStatusCode() const; | ||
}; | ||
|
||
} // namespace printer | ||
} // namespace s2j |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters