sexta-feira, 28 de agosto de 2020

DICAS 3056 - WINDEV TUTORIAL 79 -04-09-2020 11Hrs- OTIMIZAR ANALISADOR DE DESEMPENHO

https://youtu.be/w3HJ3X-PnSA




Bom Dia/Boa Tarde/Boa Noite

Esse Ao Vivo vai estrear as 11:00 do dia 04/09/2020 

DICAS 3056 - WINDEV TUTORIAL 79 -04-09-2020 11Hrs- OTIMIZAR ANALISADOR DE DESEMPENHO
Tutoriel WINDEV : Leçon 6.3. Optimiser et déboguer - Analyseur de performances

ASSUNTOS

VAMOS VER O QUE SERA ENSINADO
VISAO GERAL
O QUE PROFILER
INICIANDO O PERFIL DE DESEMPENHO 
DUAS OPCOES
PELO EDITOR WINDEV
POR PROGRAMACAO 
profillerstart
profillerend 
INICIANDO TESTE DE DESEMPENHO 
ESTUDANDO O RESULTADO




Video original da Franca

https://youtu.be/wdYlVdAzE5I


Playlist Windev TUTORIAL

Repositorio Windev

https://repository.windev.com/












DICAS 2978 - WINDEV TUTORIAL 1 - 1.1B - WINDEV TEMA ESCURO E IDIOMA DO AMBIENTE
DICAS 2979 - WINDEV TUTORIAL 2 - 1.2- CRIAR JANELA E INSERIR TEXTO E EXIBIR
DICAS 2980 - WINDEV TUTORIAL 3 - 2.1- VARIAVEIS PARTE 1
DICAS 2981 - WINDEV TUTORIAL 4 - 2.2- VARIAVEIS ESCOPO - PARTE 2
DICAS 2982 - WINDEV TUTORIAL 5 - 2.1- VARIAVEIS OPERADORES PARTE 3
DICAS 2983 - WINDEV TUTORIAL 6 - 2.1.D - VARIAVEIS STRINGS PARTE 4
DICAS 2984 - WINDEV TUTORIAL 7 - 2.1.E - VARIAVEIS ARRAYS PARTE 5
DICAS 2985 - WINDEV TUTORIAL 8 - 2.2.A - CONDICOES IF-SWITCH PARTE 1
DICAS 2986 - WINDEV TUTORIAL 9 - 2.2.B - CONDICOES PARTE 2
DICAS 2987 - WINDEV TUTORIAL 10 - 2.3.A - LOOP PARTE 1
DICAS 2988 - WINDEV TUTORIAL 11 - 2.3.B - LOOP EXEMPLOS PARTE 2
DICAS 2989 - WINDEV TUTORIAL 12 - Lesson 2.4. The procedures - PARTE 1
DICAS 2990 - WINDEV TUTORIAL 13 - Leçon 2.4.b. Procedures Parametros - PARTE 2
DICAS 2991 - WINDEV TUTORIAL 14 - PROCEDURES REFERENCIA - PARTE 3
DICAS 2992 - WINDEV TUTORIAL 15 - PROCEDURES OPCIONAIS OU OBRIGATORIAS - PARTE 4
DICAS 2993 - WINDEV TUTORIAL 16 - PROCEDURES EXEMPLOS - PARTE 5
DICAS 2994 - WINDEV TUTORIAL 17 - PERGUNTAS E RESPOSTA - PARTE 1
DICAS 2995 - WINDEV TUTORIAL 18 - PERGUNTAS E RESPOSTA - PARTE 2
DICAS 2996 - WINDEV TUTORIAL 19 - WINDEV E OS BANCOS DE DADOS
DICAS 2997 - WINDEV TUTORIAL 20 - PROJETO E ANALISE - CRIACAO
DICAS 2998 - WINDEV TUTORIAL 21 - PROJETO E ANALISE - ARQUIVOS DADOS CLIENTE - PARTE 2
DICAS 2999 - WINDEV TUTORIAL 22 - PROJETO E ANALISE - ARQUIVOS DADOS CRIACAO ARQUIVO PEDIDO - PARTE 3
DICAS 3000 - WINDEV TUTORIAL 23 - PROJETO E ANALISE - IMPORTANDO CVS-ARQUIVO TEXTO - PARTE 4
DICAS 3001 - WINDEV TUTORIAL 24 - PROJETO E ANALISE - IMPORTANDO ARQUIVO PRODUTO - PARTE 5
DICAS 3002 - WINDEV TUTORIAL 25 - PROJETO E ANALISE - LINK - PARTE 6
DICAS 3003 - WINDEV TUTORIAL 26 - RAD COMPLETO
DICAS 3004 - WINDEV TUTORIAL 27 - VISAO GERAL
DICAS 3005 - WINDEV TUTORIAL 28 - Adicionar e Modificar Janelas PRODUTOS - PARTE A
DICAS 3006 - WINDEV TUTORIAL 29 - Adicionar e Modificar Janelas PRODUTOS Formulario - PARTE B
DICAS 3007 - WINDEV TUTORIAL 30 - Adicionar e Modificar Janelas PRODUTOS ALINHAR CAMPOS - PARTE C





Lesson 6.3. Performance profiler
This lesson will teach you the following concepts
  • Overview.
  • Starting the performance profiler.
  • Studying the result.
Lesson duration

Estimated time: 15 mn
Previous LessonTable of contentsNext Lesson
Overview
The performance profiler (also called Profiler) is a tool used to check and optimize the execution time of the processes found in your application.
The principle is straightforward:
  • You run the test of your application.
  • During this test, the performance profiler keeps track of all actions performed and saves the execution times of each one of the processes run.
At the end of test, the performance profiler displays:
  • the 10 most time consuming operations,
  • the duration and the number of calls for all processes run.
The "WD Optimization" project contains a specific window used to see the interesting results with the performance profiler.
Starting the performance profiler
The performance profiler can be started:
  • from the WINDEV editor:
    In this case, the project is automatically run in test mode. You can use your application and start the processes of your choice.
    To go back to the WINDEV editor, all you have to do is exit from your application.
    Then, the performance profiler displays the monitoring result. This result is saved in a WPF file.
  • from one of your WLanguage processes, with the following functions:
    ProfilerStartStarts "collecting data" for the performance profiler.
    ProfilerEndStops "collecting data" for the performance profiler.

    In this case, only the code found between ProfilerStart and ProfilerEnd is studied. The result is saved in a WPF file.
  • The first method will be used in our example. To start the performance profiler on the "WD Optimization" project:
    1. On the "Project" pane, "Audit and performance" group, expand "Analyze performance" and select "Analyze performance".

      Remark

      The performance profiler can also be started from the project dashboard, via the "Performance" widget. Simply:
      • enable the Widget if necessary (click the link "Click here to re-enable").
      • expand the button with arrow and select "Analyze the performance".
        Widget on the dashboard
    2. The project test is run.
    3. Click the "Test window of performance profiler" button.
    4. Click the "Process to analyze" button.
    5. Validate the information window and stop the project test. The performance profiler report window appears.
Studying the result
  • Let's study the report window of the performance profiler. Results are displayed in several tabs:
    • the "Summary" tab presents the ten longest processes.
    • the "Mapping" tab presents a graphical view of main processes.
    • the "Details" tab presents all processes run during the application test (from the slowest one to the fastest one).
    • the "Calls" tab is used to view the details of operations performed in a process.
  • Let's present these different tabs in our example.
    • The "Summary" tab presents the ten longest processes. In our example, you can see that the local procedure named "UpdateProductStock" takes more than 3 seconds to run.
      Performance profiler - Summary
    • The "Mapping" tab is used to visually identify what took the longest time. In our case, it's a call to Ping:
      Performance profiler - Mapping
    • The "Details" tab presents all processes or events run, from the slowest one to the fastest one.
      Performance profiler - Details
      The following information is displayed for each process or event:
      • Function: Function, event or procedure run.
      • Total time: Execution time of function.
      • Internal time: Execution time due to the engine.
      • Nb of calls: Number of calls made to the function (procedure or event).
      • Time 1 call: Execution time of a call to the function (procedure or event).
      • Code %: Percentage of time spent in the process of function or procedure (developer code that can be optimized).
      • Parent: Element that contains the process.
  • In our case, the "Details" tab indicates that the call to the "Ping" function is one of the elements taking the longest time.
    1. Select this line. We are going to check whether this slowdown is caused by a specific problem.
    2. Click the "Calls" button to display the details of calls to the UpdateProductStock procedure. Select the "Ping" line and click the "Code" button: the corresponding code line is displayed in the code editor.
    3. Close the performance profiler.
    4. The following code line is run:
      // Checks the accessibility of supplier server
      Ping("supplier-addr")
      The slowdown is caused by the fact that the address specified for Ping is not accessible.
  • Let's check the operating mode of application by optimizing this code:
    1. Replace the code line containing Ping by the following code line:
      // Checks the accessibility of supplier server
      Ping("www.google.fr")
    2. Save the code (Ctrl + S).
  • We are now going to restart the performance profiler:
    1. On the "Project" pane, "Audit and performance" group, expand "Analyze performance" and select "Analyze performance".
    2. The project test is run.
    3. Click the "Test window of performance profiler" button.
    4. Click the "Process to analyze" button.
    5. Validate the information window and stop the project test. The performance profiler report window appears.
    6. In the "Mapping" tab, Ping does not appear with the same importance.
      Performance profiler - Mapping
  • Close the performance profiler report window.







DICAS 3055 - WINDEV TUTORIAL 78 -04-09-2020 09Hrs- PROJETO OTIMIZAR E DEPURAR



https://youtu.be/jT504xmXnP0


Bom Dia/Boa Tarde/Boa Noite


Esse Ao Vivo vai estrear as 09:00 do dia 04/09/2020 

DICAS 3055 - WINDEV TUTORIAL 78 -04-09-2020 09Hrs- PROJETO OTIMIZAR E DEPURAR
Tutoriel WINDEV : Leçon 6.2. Optimiser et déboguer - Audits du projet

ASSUNTOS

MUITO TOP, NAO USAVA E AGORA VOU USAR
O QUE VAMOS APRENDER NESSA LICAO 
O QUE É UMA AUDITORIA ESTATICA E DINAMICA 
MOSTRANDO AUDITORIA ESTATICA 
ENTRANDO NO PROJETO OTIMIZA E ENTRANDO AUDITORIA 
ESCOLHENDO AUDITORIA TODO PROJETO
EXPLICANDO O QUE APARECEU NOS RESULTADOS DA AUDITORIA 
EXPLICANDO QUANDO TEM UM CODIGO QUE NAO SE USA MAIS 
MOSTRANDO ELEMENTO ORFAO, JANELA NUNCA CHAMADA
FAZENDO LIMPESA DE ARQUIVOS NAO UTILIZADOS NO PROJETO
ERRO DE VERSAO E ARRUMANDO
EXPLICANDO AUDITORIA DINAMICA
EXECUTANDO O TESTE 
EXPLICANDO O TESTE
EXPLICANDO COMO FAZER ESSA AUDITORIA EM CLIENTE


Video original da Franca

https://youtu.be/Nihd09vTHeY


Playlist Windev TUTORIAL

Repositorio Windev

https://repository.windev.com/


https://youtu.be/3DshsXJ8I2M

https://youtu.be/EqnYJFpvPAI




DICAS 2978 - WINDEV TUTORIAL 1 - 1.1B - WINDEV TEMA ESCURO E IDIOMA DO AMBIENTE
DICAS 2979 - WINDEV TUTORIAL 2 - 1.2- CRIAR JANELA E INSERIR TEXTO E EXIBIR
DICAS 2980 - WINDEV TUTORIAL 3 - 2.1- VARIAVEIS PARTE 1
DICAS 2981 - WINDEV TUTORIAL 4 - 2.2- VARIAVEIS ESCOPO - PARTE 2
DICAS 2982 - WINDEV TUTORIAL 5 - 2.1- VARIAVEIS OPERADORES PARTE 3
DICAS 2983 - WINDEV TUTORIAL 6 - 2.1.D - VARIAVEIS STRINGS PARTE 4
DICAS 2984 - WINDEV TUTORIAL 7 - 2.1.E - VARIAVEIS ARRAYS PARTE 5
DICAS 2985 - WINDEV TUTORIAL 8 - 2.2.A - CONDICOES IF-SWITCH PARTE 1
DICAS 2986 - WINDEV TUTORIAL 9 - 2.2.B - CONDICOES PARTE 2
DICAS 2987 - WINDEV TUTORIAL 10 - 2.3.A - LOOP PARTE 1
DICAS 2988 - WINDEV TUTORIAL 11 - 2.3.B - LOOP EXEMPLOS PARTE 2
DICAS 2989 - WINDEV TUTORIAL 12 - Lesson 2.4. The procedures - PARTE 1
DICAS 2990 - WINDEV TUTORIAL 13 - Leçon 2.4.b. Procedures Parametros - PARTE 2
DICAS 2991 - WINDEV TUTORIAL 14 - PROCEDURES REFERENCIA - PARTE 3
DICAS 2992 - WINDEV TUTORIAL 15 - PROCEDURES OPCIONAIS OU OBRIGATORIAS - PARTE 4
DICAS 2993 - WINDEV TUTORIAL 16 - PROCEDURES EXEMPLOS - PARTE 5
DICAS 2994 - WINDEV TUTORIAL 17 - PERGUNTAS E RESPOSTA - PARTE 1
DICAS 2995 - WINDEV TUTORIAL 18 - PERGUNTAS E RESPOSTA - PARTE 2
DICAS 2996 - WINDEV TUTORIAL 19 - WINDEV E OS BANCOS DE DADOS
DICAS 2997 - WINDEV TUTORIAL 20 - PROJETO E ANALISE - CRIACAO
DICAS 2998 - WINDEV TUTORIAL 21 - PROJETO E ANALISE - ARQUIVOS DADOS CLIENTE - PARTE 2
DICAS 2999 - WINDEV TUTORIAL 22 - PROJETO E ANALISE - ARQUIVOS DADOS CRIACAO ARQUIVO PEDIDO - PARTE 3
DICAS 3000 - WINDEV TUTORIAL 23 - PROJETO E ANALISE - IMPORTANDO CVS-ARQUIVO TEXTO - PARTE 4
DICAS 3001 - WINDEV TUTORIAL 24 - PROJETO E ANALISE - IMPORTANDO ARQUIVO PRODUTO - PARTE 5
DICAS 3002 - WINDEV TUTORIAL 25 - PROJETO E ANALISE - LINK - PARTE 6
DICAS 3003 - WINDEV TUTORIAL 26 - RAD COMPLETO
DICAS 3004 - WINDEV TUTORIAL 27 - VISAO GERAL
DICAS 3005 - WINDEV TUTORIAL 28 - Adicionar e Modificar Janelas PRODUTOS - PARTE A
DICAS 3006 - WINDEV TUTORIAL 29 - Adicionar e Modificar Janelas PRODUTOS Formulario - PARTE B
DICAS 3007 - WINDEV TUTORIAL 30 - Adicionar e Modificar Janelas PRODUTOS ALINHAR CAMPOS - PARTE C













Lesson 6.2. Project audits
This lesson will teach you the following concepts
  • What is an audit and what is its purpose?
  • Starting and studying the static audit.
  • Starting and studying the dynamic audit.
Lesson duration

Estimated time: 15 mn
Previous LessonTable of contentsNext Lesson
What is an audit?
Audits provide a set of features that allow you to:
  • automatically improve the quality and performance of a project.
  • monitor the conditions in which it operates more precisely.
Two types of audits are available:
  • The static audit. The static audit performs a detailed analysis of a project and elements. This audit is performed from the project editor.
  • The dynamic audit. The dynamic audit analyzes the behavior of a project during its execution. This audit can be performed in test mode or in the production environment.
We are going to check these audits on the "WD Optimization" project.
Static audit
The static audit is an environment feature used to study the source codes of a project in order to detect different problems and to propose improvements.
  • To start the static audit on the "WD Optimization" project:
    1. On the "Project" pane, in the "Audit and performance" group, expand "Edition audit" and select "Trigger the audition audit".

      Remark

      The static audit of project can also be started from the project dashboard, via the "Static audit and Compilation" widget.
      To do so:
      • enable the Widget if necessary (click the link "Click here to re-enable").
      • click the arrow.
        Static audit Widget
    2. The wizard starts. We are going to define the target of static audit.
      Static audit
    3. Select "Run the static audit on the entire project".
    4. Validate the wizard.
    5. The audit report is displayed:
      Audit report
The static audit includes:
  • The static audit of project.
  • The audit for the content of application library.
  • The audit of setup content.
  • Let's study the topics presented by this report.

Procedure not run

In our project, the audit indicates that a procedure is never run.
In huge projects, you may want to create one or more procedures to perform a process then, further to a code reorganization, the procedure is no longer used but it remains in the project. The presence of unused procedures unnecessarily consumes the resources distributed to the end users.
  • To fix this problem:
    1. Click the [...] button to get more details. The window that lists the dead codes is displayed.
      Procedure not run - Dead code
    2. The "ObsoleteProcedure" procedure is never called. This window is used to:
      • specify that the procedure is still used ("Flag as useful"). In this case, the procedure will not be taken into account anymore during the audit.
      • delete the procedure if it is actually unused ("Delete").
      • see the procedure ("View").
      • find the use cases in the strings for example ("Search").
    3. In our case, this procedure is actually unused, click "Delete".
    4. A window is displayed, asking you to confirm the deletion. Click the "Delete" button to confirm the deletion.
    5. Close the window of dead code (click the cross in the top right corner).
  • In the window of static audit, click the "Refresh" button to update the audit report.

Orphan element

The audit indicates that our project contains an orphan element.
As for the procedures run, you may create windows or reports in order to run a quick test, save them and forget everything about them. The presence of orphan elements in the executable unnecessarily consumes the resources distributed to the end users.
  • To fix this problem:
    1. Click the [...] button to get more details. The window that lists the orphan elements is displayed.
      Orphan element
    2. The "WIN_UnusedWindow" window is never called. The window that lists the orphan elements is used to:
      • specify that the element is still used ("Flag as useful"). In this case, the window will not be taken into account anymore during the audit. This option can be interesting when using a test window specific to the development for example.
      • delete the element if it is actually unused ("Delete").
      • see the element ("View").
      • find the use cases in the strings for example ("Search").
    3. In our case, this "WIN_UnusedWindow" window is actually unused, click "Delete".
    4. Close the window of orphan elements (click the cross in the top right corner).
  • In the window of static audit, click the "Refresh" button to update the audit report.

Cleaning the project

Our project contains several unused files. You have the ability to clean the project in order to keep the necessary elements only. The executable and the client setup is not weighted with images, external files, ... not used.
  • To fix this problem:
    1. Click the [...] button to get more details.
    2. The project cleanup wizard starts. This wizard indicates the unused files that can be deleted.
    3. Go to the next step.
    4. Select the type of cleanup to perform. You can:
      • create a zip file with the useless files.
      • move the useless files into a specific directory.
    5. Validate the option proposed by default and go to the next step.
    6. Finish the wizard.
Our project was optimized according to the tips given by the static audit.
The static audit is used to get an overall status on the source code of your project. Our advice: run it on a regular basis!
Let's see what happens at run time by starting the dynamic audit.
Dynamic audit
The dynamic audit is used to study the application execution. The audit is used to detect problems such as:
  • Excessive memory consumption,
  • Slowness of algorithms used,
  • Errors "hidden" at runtime,
  • ...
A dynamic audit can be performed in a test environment or on a live application.
The "WD Optimization" project contains a specific window triggering errors that can be detected by the dynamic audit.
The dynamic audit and the project test will be started at the same time.
  • To start the dynamic audit on the "WD Optimization" project:
    1. On the "Project" pane, in the "Test mode" group, expand "Test mode" and select "Debug the project while the audit is enabled". The project test is run.

      Remark

      The dynamic audit of the project can also be started from the project dashboard, via the "Execution" widget. To do so:
      • enable the Widget if necessary (click the link "Click here to re-enable").
      • expand the arrow and select "Detailed Go of project".
        Widget on the dashboard
      Remark: The dynamic audit is automatically run whenever the application is started by a project GO. A report is automatically displayed in the project dashboard:
      Widget on the dashboard
    2. Click the "Test window of dynamic audit" button.
    3. Click the different buttons found in the window. At the end of each process, a toast message is displayed to specify that the process is over. For the "Assertion and Exception" option, an assertion is displayed: click "Continue" in order for the message to appear in toast format.
    4. Stop the application test.
    5. The report window of the dynamic audit appears.
Report of the dynamic audit
  • Let's study this window:
    • The top section of this window is used to choose the display mode of data. You can:
      • choose a chronological display (respecting the order in which the events occurred) or an overall display, used to group the different types of problems. In this case, the chronological border allows you to see the position and importance of problems.
      • choose the type of problem to display (error, assertion, ...). This allows you for example to concentrate on the major errors, ...
    • The bottom section of this window displays the different events that occurred and that may cause problems in the application.
  • In this example, the dynamic audit detects several problems:
    • An excessively long caption that is assigned by programming,
    • A SWITCH loop for which no CASE is run,
    • An assertion is triggered instead of an exception,
    • The opening of a file that does not exist,
    • The assignment of a nonexistent image file to an Image control.
    For each problem, a "..." button is used to access the event details. If the event is linked to a specific line of code, the  button allows you to open the code editor directly at the corresponding location in order to fix the problem.
  • Close the window of dynamic audit.

Remark

The dynamic audit of a project can also be performed when an application is deployed on the user computers.
You can:
  • modify the application and use dbgEnableAudit to start the audit.
  • use a text file in the application directory. This solution allows you not to modify the executable. Simply create a file in the same directory and with the same name as the executable, but with a ".WX" extension.
The audit generates a ".wdaudit" file, this file must be loaded in the development environment in order to study the result.
See Dynamic audit for more details.

Teste

Teste
teste