예제 #1
0
int main()
{
	std::vector<double> testC;
	testC.push_back(1);
	testC.push_back(4);
	testC.push_back(6);
	testC.push_back(9);
	testC.push_back(2);
	testC.push_back(7);
	std::cout<< "Average:" <<averageOfContainer<double>(testC) << std::endl;
	std::cout<<"Standard Diviation:" << standardDiviation(testC)<< std::endl;
	std::cout<<"Timing of sd: " << timingOfFunction(standardDiviation(testC)) << std::endl;
	std::cout<<"Average timing of sd: "<<averageTime(standardDiviation(testC)) << std::endl;

	return 0;
}
예제 #2
0
void clockTimer::write()
{
    if(time_.outputTime())
    {

        if(Pstream::master() && writeOut_)
        {
            scalarField timeField(1, time_.timeOutputValue());
            scalarField instantDuration(1, averageTimeWriteInterval());
            scalarField cumulDuration(1, averageTime());

//             fileName casePath(time_.path());

//             writeTimeData
//             (
//                 timePath_,
//                 "cpuTimeProcess_"+fieldName_+"_instant.xy",
//                 timeField,
//                 instantTimeDuration_,
//                 true
//             );

            writeTimeData
            (
                 timePath_,
                 "cpuTimeProcess_"+fieldName_+"_instant.xy",
                 timeField,
                 instantDuration,
                 true
             );
            
            writeTimeData
            (
                timePath_,
                "cpuTimeProcess_"+fieldName_+"_average.xy",
                timeField,
                cumulDuration,
                true
            );

        }
        
        // reset
        instTimeIndex_ = 0.0;
        instantDuration_ = 0.0;
    }
}
 void AddContolPoint(Vector vp, float t){
     if(n == 1){
         vs[0] = (vp - cps[0]) * (1 / (t-ts[0]));
     }
     if(n < n_circles){
         cps[n] = vp;
         ts[n] = t;
         n++;
     }
     if(n == n_circles){
         cps[n] = cps[0];
         catmull_idoplus = averageTime();
         ts[n] = ts[n-1] + catmull_idoplus;
         vs[n] = vs[0];
         calculateSpeed();
         n++;
     }
 }
예제 #4
0
void clockTimer::stopClock()
{
    timeval endTime;
//     timespec endTime;
    scalar seconds = 0.0;
    scalar useconds = 0.0;

//     clock_gettime(CLOCK_MONOTONIC, &endTime);
    gettimeofday(&endTime, NULL);

    seconds  = endTime.tv_sec  - lastTime_.tv_sec;
//     nseconds = endTime.tv_nsec - lastTime_.tv_nsec;
    useconds = endTime.tv_usec - lastTime_.tv_usec;

    scalar duration = seconds + (useconds*1e-6);

    duration_ = duration;
    instantDuration_ += duration;
    totalDuration_ += duration;

    instTimeIndex_ += 1.0;
    timeIndex_ += 1.0;

    
    Info<< "Duration: " << fieldName_ << ", inst. = " << duration
        << " s   av. write int. = " << averageTimeWriteInterval()
        << " s   av. sim. = " << averageTime()
        << " s   tot. = " << totalDuration_ << " s"
        << endl;

//     elapsedMicroCpuField_[index_] = duration_;
//     elapsedCpuField_[index_] = time_.elapsedCpuTime();



    write();
}
void PerformanceRecordWidget::sortMenu() {
    QMenu* menu = new QMenu();
    QActionGroup* timeActions = new QActionGroup(this);
    QActionGroup* sortActions = new QActionGroup(this);
    QActionGroup* showActions = new QActionGroup(this);

    timeActions->addAction(useAverageTime_);
    timeActions->addAction(useLastTime_);

    menu->addAction(useAverageTime_);
    menu->addAction(useLastTime_);

    menu->addSeparator();

    sortActions->addAction(sortByTotalProcessTime_);
    sortActions->addAction(sortByBeforeProcessTime_);
    sortActions->addAction(sortByProcessTime_);
    sortActions->addAction(sortByAfterProcessTime_);

    menu->addAction(sortByTotalProcessTime_);
    menu->addAction(sortByBeforeProcessTime_);
    menu->addAction(sortByProcessTime_);
    menu->addAction(sortByAfterProcessTime_);

    menu->addSeparator();

    showActions->addAction(showTotalProcessTime_);
    showActions->addAction(showBeforeProcessTime_);
    showActions->addAction(showProcessTime_);
    showActions->addAction(showAfterProcessTime_);

    menu->addAction(showTotalProcessTime_);
    menu->addAction(showBeforeProcessTime_);
    menu->addAction(showProcessTime_);
    menu->addAction(showAfterProcessTime_);

    menu->addSeparator();

    menu->addAction(clearTreeWhenRecordsUpdate_);

    menu->addSeparator();

    menu->addAction(resetPerformanceRecords_);

    QAction* action = menu->exec(QCursor::pos());
    if (action) {
        if(action == sortByTotalProcessTime_) {
            emit sort(PerformanceRecordTreeWidget::TimeTypeTotalProcess);
        }
        else if (action == sortByBeforeProcessTime_) {
            emit sort(PerformanceRecordTreeWidget::TimeTypeBeforeProcess);
        }
        else if (action == sortByProcessTime_) {
            emit sort(PerformanceRecordTreeWidget::TimeTypeProcess);
        }
        else if (action == sortByAfterProcessTime_) {
            emit sort(PerformanceRecordTreeWidget::TimeTypeAfterProcess);
        }
        if (action == showTotalProcessTime_) {
            emit show(PerformanceRecordTreeWidget::TimeTypeTotalProcess);
        }
        else if (action == showBeforeProcessTime_) {
            emit show(PerformanceRecordTreeWidget::TimeTypeBeforeProcess);
        }
        else if (action == showProcessTime_) {
            emit show(PerformanceRecordTreeWidget::TimeTypeProcess);
        }
        else if (action == showAfterProcessTime_) {
            emit show(PerformanceRecordTreeWidget::TimeTypeAfterProcess);
        }
        if (action == useAverageTime_ || action == useLastTime_) {
            emit averageTime(useAverageTime_->isChecked());
        }
        if (action == clearTreeWhenRecordsUpdate_) {
            tree_->clearTreeOnUpdate_ = clearTreeWhenRecordsUpdate_->isChecked();
        }
        if (action == resetPerformanceRecords_) {
            emit clearRecords();
        }
        saveSettings();
    }
}