BBC BASIC for Windows
« PROFILER UTILITY »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 9:58pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1 2 3  Notify Send Topic Print
 veryhotthread  Author  Topic: PROFILER UTILITY  (Read 5804 times)
Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: PROFILER UTILITY
« Reply #15 on: Jun 5th, 2009, 08:12am »

I'll look into this when I get back to Oz. I agree that it would better to make it compatible.

Michael
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: PROFILER UTILITY
« Reply #16 on: Jun 5th, 2009, 09:26am »

Quote:
I'll look into this when I get back to Oz. I agree that it would better to make it compatible.

You might like to look at how my recently-released Macro Recorder utility behaves in this respect. It has two features in particular that help compatibility with Malcolm's utility:

Firstly, it always uses the presence (or otherwise) of its name in the 'utilities list' (in the registry) as the primary test of whether it has previously been installed. Therefore it will never think it's already installed if the user has managed to delete it from this list (by any means), or think it isn't installed when it's in the list.

Secondly, it will install correctly even if its files and/or registry entries are missing or inconsistent. It always presents the option to install afresh at any slot number, even if it believes it is already installed. Therefore whatever the previous condition the user can decide to re-install it in its existing slot (i.e. upgrade), move it to a new slot or remove it entirely (the 'remove' option is only enabled if it is found in the existing list).

Second-guessing the user, by presenting only a subset of options depending on what the installer (unreliably) believes is the existing condition (e.g. offering only 'remove' if thinks it is already installed) is poor practice and liable to result in a high degree of user frustration!

Richard.

User IP Logged

flamerz
New Member
Image


member is offline

Avatar




PM


Posts: 2
xx Re: PROFILER UTILITY
« Reply #17 on: May 1st, 2013, 2:17pm »

I have installed BBC 5.94a and Profiler 3.0d.

When I have some code and start the profiler, it starts with a "Mistake", and i have to write "Run" manually.

I'm doing something wrong?

Currently using windows 7.

The link for the v4 beta is missing.

update: this only happens when i use the "lowercase keywords" option.
« Last Edit: May 1st, 2013, 3:35pm by flamerz » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: PROFILER UTILITY
« Reply #18 on: May 2nd, 2013, 08:15am »

on May 1st, 2013, 2:17pm, flamerz wrote:
When I have some code and start the profiler, it starts with a "Mistake", and i have to write "Run" manually.

I'm doing something wrong?

I don't know whether Michael Hutton (the author of the profiler utility) is monitoring this forum any more. Unfortunately he has never released the source code, so really he is the only person who can comment on your problem.

I know from experience that it's easy to forget to test utilities with the Lowercase Keywords option enabled, so it may be that is what has happened.

Richard.
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: PROFILER UTILITY
« Reply #19 on: May 4th, 2013, 12:11pm »

on May 2nd, 2013, 08:15am, Richard Russell wrote:
I don't know whether Michael Hutton (the author of the profiler utility) is monitoring this forum any more.


I get some emails about certain topics, but I don't regularly scan the board anymore.

Quote:
When I have some code and start the profiler, it starts with a "Mistake", and i have to write "Run" manually.

I'm doing something wrong?


Yes. Using lowercase keywords.

No, but seriously you have found a bug which had never cropped up during testing and I had never tested for, or even, thought about.

When you run the profiler utility it runs a separate .exe which is passed the window handle of the requesting IDE. The program is then tokenized line by line by sending the exe each line via the window messages and saved as a temporary *tokenized* program and then reloaded back into the memory of the profiler and then run in that environment.

The problem lies in the tokenization of the program.

Code:
 1190   Dummy% = EVAL("0:"+$$(buffer%+5))
 1200   Line$ = $(!332+2)
 


the EVAL statement won't recognise the keywords as it stands unless I explicitly state that they are lowercase.

I don't know if I can test the IDE from another program to see if bit 3 of ?419 is set (*LOWERCASE ON) but I will mess around and see if I can do it.

I expect it cannot be done so it might just be the case that you can only profile a program in the IDE which is not in lowercase.

Sorry about that.

Quote:
Unfortunately he has never released the source code..


I have always been willing but I remember at the time there was some concern about some of the code in which all the utilities use. Is that still a concern? I know you Richard have seen the code and may still have a copy of it lying around but I don't know.

Is there any objection to me posting it?


Michael
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: PROFILER UTILITY
« Reply #20 on: May 4th, 2013, 9:48pm »

on May 4th, 2013, 12:11pm, Michael Hutton wrote:
I don't know if I can test the IDE from another program to see if bit 3 of ?419 is set

Other utilities which need to know the 'lowercase keywords' setting (the Cross Reference utility is one) simply look in the registry to find it:

Code:
      key$ = "Software\R T Russell\BBC BASIC for Windows\Settings"
      IF FNreadregistrybin(HKEY_CURRENT_USER, key$, "Lowercase", ^Lowercase%, 4)
      IF Lowercase% THEN *lowercase on 

Quote:
there was some concern about some of the code in which all the utilities use. Is that still a concern?

Looking back through this thread the concern seemed to be about compatibility with Malcolm's 'My Utilities' manager, in particular that the profiler is happy to be removed (without confusing a subsequent re-installation) and moved from one slot to another using that tool. So long as that is the case I can't see there being a problem.

Incidentally I vaguely remember an issue (possibly with an older version) related to the profiler using its own copy of the run-time engine, which if an older version than the one being used by the IDE can result in all sorts of strange symptoms, because profiling the program means effectively running it with an old version of BB4W! Is that fixed?

Oh, and the profiler utility doesn't seem to work at all on 64-bit Windows! That's obviously a very serious problem, given that almost every PC bought today will be running Win64, so it ought to be a high priority for being fixed if you're doing any work.

Quote:
I know you Richard have seen the code and may still have a copy of it lying around but I don't know.

No, I've never seen the code; if you ever gave me a copy, and I don't think you did, I've long since lost it. That was my main concern really; I wouldn't necessarily expect you to publish the source - I don't do that for any of my utilities - but it is the only one of the utilities distributed with BB4W that I have no way of maintaining.

Richard.
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: PROFILER UTILITY
« Reply #21 on: May 5th, 2013, 2:44pm »

No, it doesn't use it's own run time engine anymore. It is compiled with the latest, or is it, hmm. how would I know? Anyway, I am sure it is not the special version of the runtime engine which was required because of some nasty tricks like flushing the @lib$ and @dir$ buffers could lead to whole folders being deleted for some reason. However this is now *not\8 an issue.

So you can find out the lowercase keywords via the registry.

I am will upload the code to the yahoo groups so that it could be updated by anyone who wishes. I don't think I would add to it anymore, except for the lowercase keywords stuff.

Michael


User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: PROFILER UTILITY
« Reply #22 on: May 5th, 2013, 2:59pm »

I have never had a problem with the 64 bit windows. What do you experience?

Michael
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: PROFILER UTILITY
« Reply #23 on: May 5th, 2013, 4:19pm »

Can I "borrow" the FNreadregistrybin function please?

Michael
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: PROFILER UTILITY
« Reply #24 on: May 5th, 2013, 9:38pm »

on May 5th, 2013, 2:44pm, Michael Hutton wrote:
No, it doesn't use it's own run time engine anymore. It is compiled with the latest, or is it, hmm. how would I know?

I'm not sure that you fully understood the question. The point is that it should not matter whether or not the profiler utility was compiled with the latest run-time engine. It would obviously be highly undesirable to have to re-compile the utility every time a new version of BB4W was released, not to say impossible if the source code isn't available!

The original PROFILER.BBC (in EXAMPLES\TOOLS) doesn't have this problem, because it necessarily runs the user's program using the latest version (efectively it CHAINS the program). But as soon as you turn it into an add-in utility (which runs as a separate process) it become non-trivial to arrange to run the program using the latest version rather than the run-time engine embedded in the EXE.

The only way I can think of to do it is to find the BB4W installation folder from the registry, and then execute the program using the BBCWRUN.EXE to be found there. Is that how the profiler utility currently works?

Quote:
I have never had a problem with the 64 bit windows. What do you experience?

On 64-bits Windows 8, selecting Utilities... Profiler brings up the usual dialogue ('Profiler Utility 3.0d by Michael Hutton April 2009'); on clicking OK the PREPORT.TXT file is displayed immediately even though it was supposed to run the program for 30 seconds! The file says: 'Time spent profiling: 30000 milliseconds' but in fact it was a fraction of a second. It's as if the profiler is running thousands of times faster than real time!

The program I used for test purposes was EXAMPLES\GRAPHICS\CHAIN.BBC. The report file claims that all 30 seconds (actually almost no time at all) was spent in the one statement SYS "LoadImage".

Richard.
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: PROFILER UTILITY
« Reply #25 on: May 6th, 2013, 08:19am »

Quote:
Is that how the profiler utility currently works?


No, as you say it is non-trivial. In fact, one of the most non-trivial aspects of getting the utility to work is making sure that the @dir$ is correct for the program you are profiling as any resources that the program requires are in that directory rather than the profiler's directory, but that is a side issue.

It is compiled with a fairly recent BB4W run time engine. Although a theoretical problem, I am not sure in reality it is really a problem. As you say there is no active BB4W development but only bug fixes if there is really a need to recompile and ask people to update that really shouldn't be a problem. If that really is an issue (I don't believe so at the moment) then it could easily be recompiled.

Quote:
On 64-bits Windows 8, ......EXAMPLES\GRAPHICS\CHAIN.BBC.


Bizarre. I am using windows 7 64 bit and I can profile Chain. with out any problems. I am sure it is nothing to do with the 64-bit whatsoever I use 64-bit on every computer I have and have never had a problem.

Code:
Profiler report file - Mon.06 May 2013,09:17:40

File - C:\Program Files (x86)\BBC BASIC for Windows\EXAMPLES\GRAPHICS\CHAIN.BBC

Figures in the first column indicate approximate
time in milliseconds spent in each program line.

Figures in the second column indicate approximate
percentage of the total time spent in each program line.

Time spent Profiling       : 12546 milliseconds.

         1:     0.01      REM Chain
         0:               REM by David A. Williams with modifications by Richard T. Russell
         0:               
         0:               balls% = 100
         0:               
         0:               SYS "LoadImage", 0, @dir$+"BALL.ICO", 1, 32, 32, 16 TO H%
         0:               IF H%=0 ERROR 100, "Could not load file BALL.ICO"
         0:               
         0:               MODE 8
         0:               VDU 28,13,28,66,3
         0:               *ESC OFF
         0:               *FLOAT64
         0:               *REFRESH OFF
         0:               
         0:               ON ERROR OSCLI "REFRESH ON":PRINT 'REPORT$:END
         0:               
         0:               t=0
         0:               OFF
         0:               REPEAT
       466:     3.71      CLS
         0:               FOR I%=1 TO balls%
        68:     0.54      C%=320+180*SINRAD(t/3+I%)*COSRAD(t+8*I%)
        56:     0.45      D%=256+180*COSRAD(t/4+2*I%)*SINRAD(t+10*I%)
         7:     0.06      t+=0.03
      1398:    11.14      SYS "DrawIcon", @memhdc%, C%, D%, H%
        12:     0.10      NEXT I%
       126:     1.00      *REFRESH
     10412:    82.99      UNTIL INKEY(2)=32
         0:               *REFRESH ON
         0:               QUIT

         0:               Libraries and immediate mode

 
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: PROFILER UTILITY
« Reply #26 on: May 6th, 2013, 09:13am »

on May 6th, 2013, 08:19am, Michael Hutton wrote:
If that really is an issue (I don't believe so at the moment)

I'm afraid I definitely consider it to be an "issue". Specifically, any program which contains a *TIMER command (added in v5.94a) cannot be profiled, since it will generate a 'Bad command' error. More generally, every new version of BB4W contains bug fixes - that's the primary reason for the annual (or so) releases - so it's not really acceptable for the bugs to 'return' when profiling a program!

Quote:
then it could easily be recompiled.

Not by me! That is the crucial thing - I have no way of updating the profiler utility because I don't have the source. If you decide to release the source then I could recompile it - if I remember - but I'd still prefer it not to be necessary.

Quote:
I am using windows 7 64 bit and I can profile Chain. with out any problems.

I have no access to a 64-bit Windows 7 machine so I can't check that. Are there any specific tests you would like me to perform on the Windows 8 machine to trace the problem?

Quote:
I am sure it is nothing to do with the 64-bit whatsoever I use 64-bit on every computer I have and have never had a problem.

In my experience, compatibility issues are much more likely to be due to the 64-bits than to the version of Windows. For example, as you may know, *RUN doesn't work properly in Win64 (that's something I need to address in the next release of BB4W). And the Unicode string alignment issue, recently discussed on the Yahoo! group, is specific to Win64 too.

I would not anticipate the next version of BB4W being released until the September time-frame, so you have some time to find and fix the fault. But I wouldn't be able to distribute the profiler utility as it stands.

Richard.
User IP Logged

Michael Hutton
Developer

member is offline

Avatar




PM

Gender: Male
Posts: 248
xx Re: PROFILER UTILITY
« Reply #27 on: May 8th, 2013, 3:26pm »

I will email you the code. Unfortunately, I do not have the time to keep the utility up to date and I am not sure I have the skills to do so anyhow. If new 64-bit issues are a problem then you would be the best to address them. Also, the utitlity might of had it's day if there are problems with *TIMER etc, and the need to recompile all the time would make it difficult for me to keep track of the different issues which could arise.

Shame, I enjoyed making it (even if most of it is your code).

Michael
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: PROFILER UTILITY
« Reply #28 on: May 8th, 2013, 4:18pm »

on May 8th, 2013, 3:26pm, Michael Hutton wrote:
I do not have the time to keep the utility up to date and I am not sure I have the skills to do so anyhow

You and me both! My coding abilities are a mere shadow of what they once were, and I find that I make silly mistakes in even the simplest of programs. I am in little doubt that I am suffering from the early stages of dementia.

Quote:
If new 64-bit issues are a problem then you would be the best to address them.

I have only limited access to any 64-bit machines. All the main PCs which I use for testing BB4W (Windows 95, Me, 2000, XP, Windows 7 Home and Windows 7 Pro) are 32-bits. So in that sense I'm not well placed to debug 64-bit issues, but if you haven't the time I'll do what I can. Discontinuing BB4W altogether must be an option, unfortunately.

Richard.
User IP Logged

DDRM
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 321
xx Re: PROFILER UTILITY
« Reply #29 on: May 10th, 2013, 10:47am »

on May 8th, 2013, 4:18pm, Richard Russell wrote:
...Discontinuing BB4W altogether must be an option, unfortunately.


I certainly hope not, Richard! I use BB4W on 64 bit Vista on my home desktop and 64 bit Windows 7 on my laptop with no detectable problems. I know I don't stretch it much, but I'd be very sorry to lose it (and your outstanding support) for the sake of a few minor issues "at the periphery".

Best wishes,

David
User IP Logged

Pages: 1 2 3  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls