Measuring Performance


Problem 1
Create a Dialog application called Measure to measure performance of two functions. After creating the project, edit the files Measure.h, Measure.cpp and stdafx.h as shown.
Cree una aplicación de diálogo llamada Measure para medir el desempeño de dos funciones. Después de crear el proyecto, edite los archivos Measure.h, Measure.cpp y stdafx.h como se muestra.

MeasureRun

Measure.h
#pragma once //______________________________________ Measure.h
#include "Resource.h"
class Measure: public Win::Dialog
{
public:
     Measure()
     {
     }
     ~Measure()
     {
     }
     Nn::Logsig sg;
     double y[NUMB];
     void Logsig_normal();
     void Logsig_fast();
protected:
     . . .
};


Measure.cpp
. . .
void Measure::Window_Open(Win::Event& e)
{
     for (int i= 0; i < 100; i++)
     {
          Logsig_normal();
          Logsig_fast();
     }
     Win::Profiler::Display(hWnd);
}

void Measure::Logsig_normal()
{
     Win::Profiler p(__FUNCTIONW__);
     const double delta = 20.0 / NUMB;
     double x;
     for (int i = 0; i < NUMB; i++)
     {
          x = delta * i - 10.0;
          y[i] = 1.0 / (1.0 + exp(-x));
     }
}

void Measure::Logsig_fast()
{
     Win::Profiler p(__FUNCTIONW__);
     const double delta = 20.0 / NUMB;
     double x;
     for (int i = 0; i < NUMB; i++)
     {
          x = delta * i - 10.0;
          y[i] = sg.Func(x);
     }
}


stdafx.h
. . .
#define NUMB 8192


© Copyright 2000-2026 Wintempla selo. All Rights Reserved. abr. 17 2026. Home