1 / 26

Profiling Applications in

Profiling Applications in. Luis I. Gomez. 4.18. BR Profiler. BR Profiler Feature Components Profiler types Profiling an application Interpreting your results Customizing your Results Profiler.wb GUI editor (MyEdit or Notepad++) Profiler.mdb. BR Profiler. BR Profiler Feature

duyen
Télécharger la présentation

Profiling Applications in

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Profiling Applications in Luis I. Gomez 4.18

  2. BR Profiler • BR Profiler Feature • Components • Profiler types • Profiling an application • Interpreting your results • Customizing your Results • Profiler.wb • GUI editor (MyEdit or Notepad++) • Profiler.mdb

  3. BR Profiler • BR Profiler Feature • Components • Profiler types • Profiling an application • Interpreting your results

  4. BR 4.18 Profiler – Components • BR.EXE • Version 4.18+ required • PROFILER.DOC • Documentation • PROFILER.EXE • Utility to extract results.

  5. BR 4.18 Profiler – Types • SAMPLED • DEBUG SAMPLED C:\WORK\SAMPLED.TXT • Itemized profile of each and every execution clause • Can be very large • TIMED • DEBUG TIMED C:\WORK\SAMPLED.TXT • Summary of Clauses, Functions & Go Subs • Much smaller

  6. BR 4.18 Profiler – Types • STOP • DEBUG STOP • Stops profiling

  7. Profiling an Application. • Load BR 4.18+ • Prepare for profiling • Start BR • Load desired application • Start Profiler • You may start before the application runs • CTRL-A at a desired location • Imbed the profiler inside your application

  8. Profiling an Application. • Clauses • List Clause • A clause is parsed by a ` (Not Necessarily a line)

  9. Interpreting your results. • PROFILER.EXE • PROFILER.EXE filename >RESULTS.TXT • PROFILER.EXE filename RAW >RAW.TXT • PROFILER.EXE filename PRETTY >PRETTY.TXT • PROFILER.BAT • Simple Batch File to automate this complex step

  10. Interpreting your results. • DEFAULT • Simple Report with Totals • RAW • Extracts all of the information for review • PRETTY • Improved output over the default. • Viewing Results • Results are Tab Delimited for easy viewing

  11. Customizing your results. • Profiler.wb • CLS application (Available for general use) • Required BR 4.18+ • Enter the “C:\WORK\PROFILE.TXT” file

  12. Customizing your results. • Output Results(Tab Delimited Reports) • Filename-Modules.txt • Filename-Results.txt • Filename-Stats.txt • Filename-Type.txt • Source Code Results • Filename-[Full Path Name].brs

  13. Customizing – Modules.txt • Filename-Modules.txt • Each module is assigned a # • 0 – (Unsaved) Proc or similar • 1 – Usually the “Primary program” • 2 – ?? Libraries or “Other programs” • Other files refer to modules by # • Nice summary • Program names • Library names

  14. Customizing – Results.txt • Filename-Results.txt • Itemized results • Fields • Module - Module # • Line - Program line # • Clause - Program line clause # • Spent - Time spent on clause • Accrued - Total time (Timeline) • Function - Function name (Timed) • Gosub - Gosub name (Timed)

  15. Customizing – Stats.txt • Filename-Stats.txt • Totals based on profiler data • Combines source code to determine • Clause type (Print, Input, etc) • SAMPLED • Provides statistics based on # & time spent • TIMED • Provides Statistics based on # of executions

  16. Customizing – Type.txt • Filename-Type.txt • Totals based on profiler data • Combines source code to determine • Clause type (Print, Input, etc) • Statistics based on clause type • Identify the “cost” of BR commands. • Ignore things like “User Input”

  17. BR 4.18 Profiler – GUI Editor • Filename-[Full Path Name].BRS • Complete source code extracted • List clause • Fields • Line # • Clause • Total # times executed • Time spent (If Sampled) • Detailed clause • Edit using MyEdit or Notepad++

  18. BR 4.18 Profiler – Profiler.mdb • Simple MS-Access database • Automatically links to • C:\WORK\PROFILE-MODULES.TXT • C:\WORK\PROFILE-RESULTS.TXT • C:\WORK\PROFILE-STATS.TXT • C:\WORK\PROFILE-TYPE.TXT

  19. BR 4.18 Profiler – Profiler.mdb • How to use • Create your profile reports • Copy the results to above file names • Execute query • This is a sample • you can be more creative!

  20. Sample Application • PRO-SLOW.WB • Sample application parses & displays the words used in STATUS ALL. • Takes roughly 30 seconds to execute • Most executed • Lines 4040,4050, 3020,3040,3100 • Longest execution time • Line 3070,4040,4050,4020,321

  21. Sample Application - Problems • Poor Placement • FNSORT_WORDS • This routine is executed many times! • Ultimately, it is only needed at the very end. • Moved to line 395

  22. Sample Application - Problems • Complex Line • 3040 – SREP & UPRC$ • One of the most executed lines • Relatively slow • Very complex & hard to read! • Move UPRC$ & break out SREP

  23. Sample Application - Problems • Longest Execution Time • 321 PRINT # • Print is very slow in GUI Mode • No need to display 1062 Times! • 3070 PRINT # & SUM • Print is very slow in GUI Mode • No Need to Display 7048 Times • Could be consolidated with 321 • Create New Counter instead of using SUM.

  24. Sample Application - Solution • PRO-FAST.WB • Application with Solutions applied • Time reduced from 30 seconds to 1 • Line 3040 • WORD$=SREP$(SREP$(SREP$(TRIM$(LINE$(1:NMARKER-1)),'"',""),",",""),"_","") • Is it Worth Faster Execution for a complex line? • Sometimes it’s actually faster to split it up. • (Not this time)

  25. Sample Application - Solution • How Far to Go? • Once we have 30 times improvement do we care? • 330 – “Stretchy Array” Is somewhat slow.

  26. Profiler – Summary • Dramatically improve performance • Identify Problem Areas • Learn about the BR Internals • Extend capabilities with your own code

More Related