00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef __freSetupOptimizationMultiThreadMetricControllerBase_txx
00023 #define __freSetupOptimizationMultiThreadMetricControllerBase_txx
00024
00025 #include "freSetupOptimizationMultiThreadMetricControllerBase.h"
00026 #include "freExceptions.h"
00027
00028 namespace FREE
00029 {
00030
00034
00035 template <class TControlledMetric>
00036 const char* const SetupOptimizationMultiThreadMetricControllerBase<TControlledMetric>::cParam_NrOfThreads = "NrOfThreads";
00037 template <class TControlledMetric>
00038 const char* const SetupOptimizationMultiThreadMetricControllerBase<TControlledMetric>::cParamDsc_NrOfThreads = "Number of threads that will be used to compute the metric measure.";
00039
00040 template <class TControlledMetric>
00041 SetupOptimizationMultiThreadMetricControllerBase<TControlledMetric>::
00042 SetupOptimizationMultiThreadMetricControllerBase()
00043 {
00044
00045 this->UpdateControllerID(ControllerID::SetupOptimizationMultiThreadMetricControllerBase);
00046 this->m_Description = "Base class for a multi threading metric.";
00047 };
00048
00049 template <class TControlledMetric>
00050 void
00051 SetupOptimizationMultiThreadMetricControllerBase<TControlledMetric>::
00052 GenerateProfile(CtrlProfile::ControllerProfile& profile,
00053 const SessionComponentCache* pComponentCache,
00054 bool bRegardOldSetup) const
00055 {
00056 Superclass::GenerateProfile(profile,pComponentCache,bRegardOldSetup);
00057
00058
00059 profile.Parameters().AddParameter(cParam_NrOfThreads,CtrlProfile::Parameter::PVTULong,cParamDsc_NrOfThreads,1,"1");
00060 };
00061
00062 template <class TControlledMetric>
00063 void
00064 SetupOptimizationMultiThreadMetricControllerBase<TControlledMetric>::
00065 ActualizeMainComponent(ComponentType* pMainComponent,
00066 SessionComponentCache* pComponentCache,
00067 SessionInfo* pSessionInfo,
00068 const unsigned int& iActLevel) const
00069 {
00070 Superclass::ActualizeMainComponent(pMainComponent, pComponentCache,
00071 pSessionInfo, iActLevel);
00072
00073 long lThreadNr;
00074 try
00075 {
00076 SessionAccessor::GetParameterValue(pComponentCache,cParam_NrOfThreads,lThreadNr);
00077 }
00078 catchAllNPassMacro("Error while retrieving parameter values.");
00079
00080 pMainComponent->SetNumberOfThreads(lThreadNr);
00081 };
00082
00083
00084 }
00085
00086
00087 #endif