OpenASIP 2.2
|
#include <TestApplication.hh>
Public Types | |
typedef double | Runtime |
typedef int | ClockCycles |
Public Member Functions | |
TestApplication (const std::string &testApplicationPath) | |
virtual | ~TestApplication () |
std::vector< std::string > | description () const |
bool | hasApplication () const |
bool | hasSetupSimulation () const |
bool | hasSimulateTTASim () const |
bool | hasCorrectOutput () const |
bool | hasVerifySimulation () const |
bool | hasCleanupSimulation () const |
bool | hasFunctionsOfInterest () const |
bool | isValid () const |
const std::string | applicationPath () const |
void | setupSimulation () const |
std::istream * | simulateTTASim () const |
const std::string | correctOutput () const |
bool | verifySimulation () const |
void | cleanupSimulation () const |
ClockCycles | cycleCount () const |
Runtime | maxRuntime () const |
const std::vector< TCEString > & | functionsOfInterest () const |
Private Attributes | |
const std::string | testApplicationPath_ |
Path of the test application directory. | |
Runtime | maxRuntime_ |
Maximum runtime of the test appication in nano seconds. | |
std::vector< TCEString > | functionsOfInterest_ |
The names of the functions of interest (in terms of cycle count). | |
Static Private Attributes | |
static const std::string | DESCRIPTION_FILE_NAME_ = "description.txt" |
File name of the description text for the application. | |
static const std::string | APPLICATION_BASE_FILE_NAME_ = "program" |
Name of the sequential program file. Base name of the file that contains the fully linked program. The actual file name will be formed by appending either .bc or .ll, whichever is found first. | |
static const std::string | SETUP_FILE_NAME_ = "setup.sh" |
Name of the file that contains setup script. | |
static const std::string | SIMULATE_TTASIM_FILE_NAME_ = "simulate.ttasim" |
Name of the file that runs the simulation. | |
static const std::string | CORRECT_OUTPUT_FILE_NAME_ |
Name of the correct simulation output file. | |
static const std::string | VERIFY_FILE_NAME_ = "verify.sh" |
Name of the verify script file. | |
static const std::string | CLEANUP_FILE_NAME_ = "cleanup.sh" |
Name of the clean up file. | |
static const std::string | FUNCTIONS_OF_INTEREST_FILE_NAME_ |
Name of the file that has a comma separated list of functions of interest for the cycle count measurements in the given app. The exclusive profile of these functions will be used as the cycle count in evaluation. | |
static const std::string | MAX_RUNTIME_ = "max_runtime" |
Name of the file that contains maximum runtime. | |
static const int | MAX_LINE_LENGTH_ = 512 |
Maximum line length in a file. | |
Class for handling files in test application directory.
Definition at line 47 of file TestApplication.hh.
typedef int TestApplication::ClockCycles |
Definition at line 50 of file TestApplication.hh.
typedef double TestApplication::Runtime |
Definition at line 49 of file TestApplication.hh.
TestApplication::TestApplication | ( | const std::string & | testApplicationPath | ) |
Constructor.
testApplicationPath | Path of the test application directory. |
Definition at line 62 of file TestApplication.cc.
References __func__, FileSystem::DIRECTORY_SEPARATOR, Exception::errorMessage(), FileSystem::fileExists(), FUNCTIONS_OF_INTEREST_FILE_NAME_, functionsOfInterest_, hasFunctionsOfInterest(), MAX_LINE_LENGTH_, MAX_RUNTIME_, maxRuntime_, TCEString::split(), testApplicationPath_, and Conversion::toDouble().
|
virtual |
const std::string TestApplication::applicationPath | ( | ) | const |
Returns the application path in the test application directory.
If the file 'sequential_program' does not exists returns an empty string.
Definition at line 335 of file TestApplication.cc.
References APPLICATION_BASE_FILE_NAME_, FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), hasApplication(), and testApplicationPath_.
Referenced by DesignSpaceExplorer::evaluate(), and SimpleICOptimizer::explore().
void TestApplication::cleanupSimulation | ( | ) | const |
Cleans up the previous simulation run.
Uses 'cleanup.sh' script if it exists.
Definition at line 220 of file TestApplication.cc.
References CLEANUP_FILE_NAME_, FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), FileSystem::runShellCommand(), and testApplicationPath_.
const std::string TestApplication::correctOutput | ( | ) | const |
Returns the correct output from file 'correct_simulation_output' as string.
Definition at line 152 of file TestApplication.cc.
References CORRECT_OUTPUT_FILE_NAME_, FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), and testApplicationPath_.
Referenced by DesignSpaceExplorer::evaluate().
ClockCycles TestApplication::cycleCount | ( | ) | const |
std::vector< std::string > TestApplication::description | ( | ) | const |
Returns the test application description.
The description is given in the description.txt file of the test application directory.
Definition at line 109 of file TestApplication.cc.
References description(), DESCRIPTION_FILE_NAME_, FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), MAX_LINE_LENGTH_, and testApplicationPath_.
Referenced by description().
|
inline |
Definition at line 78 of file TestApplication.hh.
References functionsOfInterest_.
Referenced by DesignSpaceExplorer::evaluate().
bool TestApplication::hasApplication | ( | ) | const |
Returns true if 'sequential_program' file is in the test application directory.
Definition at line 242 of file TestApplication.cc.
References APPLICATION_BASE_FILE_NAME_, FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), and testApplicationPath_.
Referenced by applicationPath(), and isValid().
bool TestApplication::hasCleanupSimulation | ( | ) | const |
Returns true if 'cleanup.sh' file is in the test application directory.
Definition at line 308 of file TestApplication.cc.
References CLEANUP_FILE_NAME_, FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), and testApplicationPath_.
bool TestApplication::hasCorrectOutput | ( | ) | const |
Returns true if 'correct_simulation_output' file is in the test application directory.
Definition at line 284 of file TestApplication.cc.
References CORRECT_OUTPUT_FILE_NAME_, FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), and testApplicationPath_.
Referenced by DesignSpaceExplorer::evaluate(), and isValid().
bool TestApplication::hasFunctionsOfInterest | ( | ) | const |
Definition at line 321 of file TestApplication.cc.
References FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileIsReadable(), FUNCTIONS_OF_INTEREST_FILE_NAME_, and testApplicationPath_.
Referenced by DesignSpaceExplorer::evaluate(), and TestApplication().
bool TestApplication::hasSetupSimulation | ( | ) | const |
Returns true if 'setup.sh' file is in the test application directory.
Definition at line 259 of file TestApplication.cc.
References FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), SETUP_FILE_NAME_, and testApplicationPath_.
bool TestApplication::hasSimulateTTASim | ( | ) | const |
Returns true if 'simulate.ttasim' file is in the test application directory.
Definition at line 271 of file TestApplication.cc.
References FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), SIMULATE_TTASIM_FILE_NAME_, and testApplicationPath_.
Referenced by DesignSpaceExplorer::simulate(), and simulateTTASim().
bool TestApplication::hasVerifySimulation | ( | ) | const |
Returns true if 'verify.sh' file is in the test application directory.
Definition at line 296 of file TestApplication.cc.
References FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), testApplicationPath_, and VERIFY_FILE_NAME_.
Referenced by isValid().
|
inline |
Definition at line 64 of file TestApplication.hh.
References hasApplication(), hasCorrectOutput(), and hasVerifySimulation().
Referenced by main().
TestApplication::Runtime TestApplication::maxRuntime | ( | ) | const |
Returns the maximum runtime that is set in file "max_runtime".
Definition at line 233 of file TestApplication.cc.
References maxRuntime_.
Referenced by FrequencySweepExplorer::fastEnough(), and MinimizeMachine::minimizeMachine().
void TestApplication::setupSimulation | ( | ) | const |
Set up the simulation run.
Uses 'setup.sh' to set up the simulation run.
Definition at line 180 of file TestApplication.cc.
References FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), FileSystem::runShellCommand(), SETUP_FILE_NAME_, and testApplicationPath_.
Referenced by DesignSpaceExplorer::simulate().
std::istream * TestApplication::simulateTTASim | ( | ) | const |
Returns a istream to 'simulate.ttasim' file.
Client takes responsibility of destroying the stream.
Definition at line 198 of file TestApplication.cc.
References FileSystem::DIRECTORY_SEPARATOR, hasSimulateTTASim(), SIMULATE_TTASIM_FILE_NAME_, and testApplicationPath_.
Referenced by DesignSpaceExplorer::simulate().
bool TestApplication::verifySimulation | ( | ) | const |
Verifies the previous simulation run.
Uses 'verify.sh' to verify the previous simulation run.
Definition at line 134 of file TestApplication.cc.
References FileSystem::DIRECTORY_SEPARATOR, FileSystem::fileExists(), FileSystem::runShellCommand(), testApplicationPath_, and VERIFY_FILE_NAME_.
|
staticprivate |
Name of the sequential program file. Base name of the file that contains the fully linked program. The actual file name will be formed by appending either .bc or .ll, whichever is found first.
Definition at line 96 of file TestApplication.hh.
Referenced by applicationPath(), and hasApplication().
|
staticprivate |
Name of the clean up file.
Definition at line 106 of file TestApplication.hh.
Referenced by cleanupSimulation(), and hasCleanupSimulation().
|
staticprivate |
Name of the correct simulation output file.
Definition at line 102 of file TestApplication.hh.
Referenced by correctOutput(), and hasCorrectOutput().
|
staticprivate |
File name of the description text for the application.
Definition at line 91 of file TestApplication.hh.
Referenced by description().
|
staticprivate |
Name of the file that has a comma separated list of functions of interest for the cycle count measurements in the given app. The exclusive profile of these functions will be used as the cycle count in evaluation.
Definition at line 111 of file TestApplication.hh.
Referenced by hasFunctionsOfInterest(), and TestApplication().
|
private |
The names of the functions of interest (in terms of cycle count).
Definition at line 88 of file TestApplication.hh.
Referenced by functionsOfInterest(), and TestApplication().
|
staticprivate |
Maximum line length in a file.
Definition at line 115 of file TestApplication.hh.
Referenced by description(), and TestApplication().
|
staticprivate |
Name of the file that contains maximum runtime.
Definition at line 113 of file TestApplication.hh.
Referenced by TestApplication().
|
private |
Maximum runtime of the test appication in nano seconds.
Definition at line 86 of file TestApplication.hh.
Referenced by maxRuntime(), and TestApplication().
|
staticprivate |
Name of the file that contains setup script.
Definition at line 98 of file TestApplication.hh.
Referenced by hasSetupSimulation(), and setupSimulation().
|
staticprivate |
Name of the file that runs the simulation.
Definition at line 100 of file TestApplication.hh.
Referenced by hasSimulateTTASim(), and simulateTTASim().
|
private |
Path of the test application directory.
Definition at line 84 of file TestApplication.hh.
Referenced by applicationPath(), cleanupSimulation(), correctOutput(), description(), hasApplication(), hasCleanupSimulation(), hasCorrectOutput(), hasFunctionsOfInterest(), hasSetupSimulation(), hasSimulateTTASim(), hasVerifySimulation(), setupSimulation(), simulateTTASim(), TestApplication(), and verifySimulation().
|
staticprivate |
Name of the verify script file.
Definition at line 104 of file TestApplication.hh.
Referenced by hasVerifySimulation(), and verifySimulation().