English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 17 January 2024, 05:01   #1
Warty
Registered User
 
Join Date: Aug 2018
Location: Minneapolis, USA
Posts: 301
VBCC -prof profiling - requirements?

I'm trying to out -prof option in VBCC, and I get tons of errors like this:

tmp.0.OCp6aN.o: In "_Action_FindThisAction":
Error 21: tmp.0.OCp6aN.o (CODE+0x28): Reference to undefined symbol __startprof.
tmp.0.OCp6aN.o: In "l1":
Error 21: tmp.0.OCp6aN.o (CODE+0x74): Reference to undefined symbol __endprof.

Code:
vlink -bamigahunk -x -Bstatic -Cvbcc -nostdlib -Z -mrel "$VBCC/targets/m68k-kick13/lib/startup.o" "/var/tmp/tmp.0.w8T6Rt.o" "/var/tmp/tmp.1.J7m1ZV.o" "/var/tmp/tmp.2.xtwhPA.o" "/var/tmp/tmp.3.dnhtFw.o" "/var/tmp/tmp.4.obH6Aw.o" "/var/tmp/tmp.5.BfnXn6.o" "/var/tmp/tmp.6.MN1aV2.o" "/var/tmp/tmp.7.NcrnbQ.o" "/var/tmp/tmp.8.O1caEi.o" "/var/tmp/tmp.9.DDYsC6.o" "/var/tmp/tmp.10.tf1Q2B.o" "/var/tmp/tmp.11.YPW6mC.o" "/var/tmp/tmp.12.asIG0s.o" "/var/tmp/tmp.13.zc9bao.o" "/var/tmp/tmp.14.12oTsZ.o" "/var/tmp/tmp.15.bOFQKr.o" "/var/tmp/tmp.16.LkmuBB.o" "/var/tmp/tmp.17.kWshnf.o" "/var/tmp/tmp.18.zHdTEt.o" "/var/tmp/tmp.19.RZljYQ.o" "/var/tmp/tmp.20.b3O5z4.o" "/var/tmp/tmp.21.Jlz3gP.o" "/var/tmp/tmp.22.1XIEgL.o" "/var/tmp/tmp.23.isbbTC.o" "/var/tmp/tmp.24.V3vNou.o" "/var/tmp/tmp.25.Jk8XIs.o" "/var/tmp/tmp.26.BZDcSw.o" "/var/tmp/tmp.27.cPl1i0.o" "/var/tmp/tmp.28.VvuMRo.o" "/var/tmp/tmp.29.iXMYbt.o" "/Users/micahbly/dev/bbedit-workspace-amiga/LichKing-Amiga/build_vbcc/ptplayer.o"   -lauto -lamiga -lreqtoolsnb -lm13 -L"$VBCC/targets/m68k-kick13/lib" -L"$VBCC/ndk13/Include-Strip1.3/lib" -lvc -o /Users/micahbly/dev/bbedit-workspace-amiga/LichKing-Amiga/build_vbcc/LichKing failed
are __endprof and __startprof in vc.lib? I can see something in there with that name, but only the vc.lib/vcs.lib that is in the m68k-amigaos target, not in the kick13 target. Is the profiling maybe not supported yet in kick13 target?
Warty is offline  
Old 17 January 2024, 16:26   #2
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
Quote:
Originally Posted by Warty View Post
but only the vc.lib/vcs.lib that is in the m68k-amigaos target, not in the kick13 target. Is the profiling maybe not supported yet in kick13 target?
Correct. And good that you remind me about it, because I had completely forgotten.
The code from m68k-amigaos cannot be used, because it depends on timer.device
UNIT_ECLOCK
and the
ReadEClock()
function, which are only present since V36. The profiler needs the time since program start in micro seconds.

Basically, the only thing I have to do is to write a Kickstart 1.x version for this:
Code:
#include <exec/types.h>
#include <exec/execbase.h>
#include <devices/timer.h>
#include <proto/exec.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>

static uint32_t _ReadEClock(__reg("a0") uint64_t *,
                            __reg("a6") void *) = "\tjsr\t-60(a6)";

static void *timerbase;
static struct timerequest timerequest;
static uint64_t start,eclock_msfactor;
static uint32_t eclock_freq;


int _prof_timerinit()
{
  if (SysBase->LibNode.lib_Version < 36)
    return 0;

  /* hack a timerequest, without CreateMsgPort() and CreateIORequest() */
  memset(&timerequest,0,sizeof(struct timerequest));
        timerequest.tr_node.io_Message.mn_Node.ln_Type = NT_REPLYMSG;
        timerequest.tr_node.io_Message.mn_Length = sizeof(struct timerequest);

  if (OpenDevice(TIMERNAME,UNIT_ECLOCK,(struct IORequest *)&timerequest,0)
      != 0) {
    fprintf(stderr,"_prof_inittimer: Can't get " TIMERNAME " for profiling!\n")
    return 0;
  }

  timerbase = timerequest.tr_node.io_Device;
  eclock_freq = _ReadEClock(&start,timerbase);
  eclock_msfactor = (1000000ULL << 16) / eclock_freq;
  return 1;
}


void _prof_timerexit()
{
  if (timerbase) {
    CloseDevice((struct IORequest *)&timerequest);
    timerbase = NULL;
  }
}


uint32_t _prof_time()
{
  uint64_t now;

  _ReadEClock(&now,timerbase);
  return (uint32_t)(now-start);
}


uint32_t _prof_micros(uint32_t ecval)

{
  /* convert EClock value to microseconds */
  return (eclock_msfactor * (uint64_t)ecval) >> 16;
}
phx is offline  
Old 18 January 2024, 02:17   #3
Warty
Registered User
 
Join Date: Aug 2018
Location: Minneapolis, USA
Posts: 301
ok, thanks for letting me know. Thanks for all you do for us, by the way.
Warty is offline  
Old 18 January 2024, 11:46   #4
patrik
Registered User
 
patrik's Avatar
 
Join Date: Jan 2005
Location: UmeƄ
Age: 43
Posts: 924
If your own code is of primary concern for profiling, you could always compile and run with profiling on 2.0+.
patrik is offline  
Old 18 January 2024, 15:24   #5
Warty
Registered User
 
Join Date: Aug 2018
Location: Minneapolis, USA
Posts: 301
yep, good point. I also have AProf working, but sometimes the results are a bit weird (impossible numbers), and virtually always there is a lot of variation in the time lengths recorded (which, I dunno, might be true anytime running functions with such short run times).

Not in any hurry...
Warty is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Profiling C code, interpreting results Ernst Blofeld Coders. C/C++ 5 19 November 2020 18:45
VBCC Profiling options ? ReadOnlyCat Coders. C/C++ 9 28 October 2020 14:22
Profiling code under WinUAE? deimos Coders. General 8 08 October 2018 17:55
Wanted: AMOS prof. documentation mombasajoe request.Other 6 03 March 2010 23:47
money cascade prof fruit machine? Damien request.Old Rare Games 8 12 March 2003 11:26

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 08:38.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.09549 seconds with 15 queries