| 1 |
/* |
| 2 |
* Copyright (C) 2013-2015, 2019 by the Konclude Developer Team. |
| 3 |
* |
| 4 |
* This file is part of the reasoning system Konclude. |
| 5 |
* For details and support, see <http://konclude.com/>. |
| 6 |
* |
| 7 |
* Konclude is free software: you can redistribute it and/or modify |
| 8 |
* it under the terms of version 3 of the GNU Lesser General Public |
| 9 |
* License (LGPLv3) as published by the Free Software Foundation. |
| 10 |
* |
| 11 |
* Konclude is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU (Lesser) General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU (Lesser) General Public |
| 17 |
* License along with Konclude. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
* |
| 19 |
*/ |
| 20 |
|
| 21 |
#include "CThreadTimesUpdateReader.h" |
| 22 |
|
| 23 |
|
| 24 |
namespace Konclude { |
| 25 |
|
| 26 |
namespace Test { |
| 27 |
|
| 28 |
namespace Analyse { |
| 29 |
|
| 30 |
namespace Reader { |
| 31 |
|
| 32 |
CThreadTimesUpdateReader::CThreadTimesUpdateReader(CThread *thread) { |
| 33 |
observedThread = thread; |
| 34 |
|
| 35 |
waitTimeValueDescription = 0; |
| 36 |
blockTimeValueDescription = 0; |
| 37 |
runTimeValueDescription = 0; |
| 38 |
|
| 39 |
if (observedThread) { |
| 40 |
waitTimeValueDescription = new CAnalyseValueDescription(); |
| 41 |
waitTimeValueDescription->setValueName(observedThread->getThreadName()+QString("-WaitTime")); |
| 42 |
waitTimeValueDescription->setTemplateValue(new CIntegerAnalyseValue(0)); |
| 43 |
|
| 44 |
blockTimeValueDescription = new CAnalyseValueDescription(); |
| 45 |
blockTimeValueDescription->setValueName(observedThread->getThreadName()+QString("-BlockTime")); |
| 46 |
blockTimeValueDescription->setTemplateValue(new CIntegerAnalyseValue(0)); |
| 47 |
|
| 48 |
runTimeValueDescription = new CAnalyseValueDescription(); |
| 49 |
runTimeValueDescription->setValueName(observedThread->getThreadName()+QString("-RunTime")); |
| 50 |
runTimeValueDescription->setTemplateValue(new CIntegerAnalyseValue(0)); |
| 51 |
} |
| 52 |
} |
| 53 |
|
| 54 |
CThreadTimesUpdateReader::~CThreadTimesUpdateReader() { |
| 55 |
if (waitTimeValueDescription) { |
| 56 |
delete waitTimeValueDescription; |
| 57 |
} |
| 58 |
if (blockTimeValueDescription) { |
| 59 |
delete blockTimeValueDescription; |
| 60 |
} |
| 61 |
if (runTimeValueDescription) { |
| 62 |
delete runTimeValueDescription; |
| 63 |
} |
| 64 |
} |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
CAnalyseValueDescription *CThreadTimesUpdateReader::getWaitTimeValueDescription() { |
| 69 |
return waitTimeValueDescription; |
| 70 |
} |
| 71 |
|
| 72 |
CAnalyseValueDescription *CThreadTimesUpdateReader::getBlockTimeValueDescription() { |
| 73 |
return blockTimeValueDescription; |
| 74 |
} |
| 75 |
|
| 76 |
CAnalyseValueDescription *CThreadTimesUpdateReader::getRunTimeValueDescription() { |
| 77 |
return runTimeValueDescription; |
| 78 |
} |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
CAnalyseValue *CThreadTimesUpdateReader::getAnalyseValueUpdate(CAnalyseValueDescription *valueDes) { |
| 83 |
CAnalyseValue *val = 0; |
| 84 |
|
| 85 |
if (valueDes == waitTimeValueDescription && observedThread) { |
| 86 |
val = new CIntegerAnalyseValue(observedThread->getWaitTimeSecs()); |
| 87 |
} else if (valueDes == blockTimeValueDescription && observedThread) { |
| 88 |
val = new CIntegerAnalyseValue(observedThread->getBlockTimeSecs()); |
| 89 |
} else if (valueDes == runTimeValueDescription && observedThread) { |
| 90 |
val = new CIntegerAnalyseValue(observedThread->getRunTimeSecs()); |
| 91 |
} |
| 92 |
return val; |
| 93 |
} |
| 94 |
|
| 95 |
|
| 96 |
|
| 97 |
}; // end namespace Reader |
| 98 |
|
| 99 |
}; // end namespace Analyse |
| 100 |
|
| 101 |
}; // end namespace Test |
| 102 |
|
| 103 |
}; // end namespace Konclude |