Hallo, Gast |
Du musst dich registrieren bevor du auf unserer Seite Beiträge schreiben kannst.
|
Foren-Statistiken |
» Mitglieder: 89
» Neuestes Mitglied: lone72
» Foren-Themen: 286
» Foren-Beiträge: 2.590
Komplettstatistiken
|
Benutzer Online |
Momentan sind 58 Benutzer online » 1 Mitglieder » 55 Gäste Bing, Google, hackball
|
Aktive Themen |
https://www.amiblitz.de
Forum: Off Topic
Letzter Beitrag: HelmutH
18.03.2025, 21:20
» Antworten: 5
» Ansichten: 752
|
AmiBlitz 3.10.0 veröffent...
Forum: News
Letzter Beitrag: HelmutH
14.03.2025, 23:27
» Antworten: 0
» Ansichten: 258
|
readserial fail (bug ?)
Forum: Questions & Answers
Letzter Beitrag: hackball
13.03.2025, 18:23
» Antworten: 14
» Ansichten: 1.565
|
ReadSerialMem example (al...
Forum: Questions & Answers
Letzter Beitrag: hackball
06.03.2025, 17:31
» Antworten: 4
» Ansichten: 725
|
Diff View (MUI)
Forum: Showcase
Letzter Beitrag: hackball
02.03.2025, 13:03
» Antworten: 0
» Ansichten: 322
|
Foren Statistik
Forum: Off Topic
Letzter Beitrag: plouf
14.02.2025, 11:48
» Antworten: 10
» Ansichten: 2.463
|
WriteSerialString fails....
Forum: Questions & Answers
Letzter Beitrag: hackball
11.02.2025, 18:34
» Antworten: 11
» Ansichten: 2.476
|
listview in Os1.3
Forum: Questions & Answers
Letzter Beitrag: hackball
09.02.2025, 21:07
» Antworten: 11
» Ansichten: 2.381
|
AmySequencer - MIDI- und ...
Forum: Projects
Letzter Beitrag: HelmutH
06.02.2025, 23:52
» Antworten: 4
» Ansichten: 11.093
|
RedPill - Game Constructi...
Forum: Projects
Letzter Beitrag: HelmutH
06.02.2025, 23:35
» Antworten: 44
» Ansichten: 106.940
|
|
|
Blitz Profiler v1.0 |
Geschrieben von: hackball - 08.12.2019, 20:07 - Forum: Showcase
- Antworten (3)
|
 |
Ohje, ich hab endlich wieder ein Projekt fertig!
Und zwar hatte ich mal letztes Jahr in einem Forum einen PROFILER für Blitzbasic2 angedeutet. Der war im Prinzip damals schon fertig, ich mußte nur noch die Zeitmessung dazubauen. Da half mir dann noname/haujobb aus.
Wieauchimmer, ich habe es jetzt (mit den gegenwärtigen Spezifikationen) fertig.
Über die Distribution muß ich noch nachdenken, ist ja kein OpenSource aber kosten soll es natürlich auch nix.
Vielleicht ein Precompile-Include oder so.
Was tut es?
Es stellt einfache Methoden zur Verfügung, benutzte Prozeduren zu zählen und die darin verbrachte Zeit zu messen.
(man muß natürlich die für das Profiling selbst benutzte Zeit im Auge behalten).
Dafür fügt man in jede zu überwachende Prozedur einen "Entry" und am Ende einen "Exit" Aufruf ein.
Am Ende kann man (bisher) ein paar Statistiken ausgeben:
Schaut mal unten auf das Beispiel, das ist kurz und verständlich.
Da ist natürlich eine GUI geplant, und statistische Auswertungen und und und.
Ist vielleicht ganz sinnvoll?
Code: ;
;test of stat/debug/ profiler possibilities
;
;by frank b., germany
;
;the symbols have obscure names to not interfere
; with others, as this is supposed to be "invisible",
; like an include or something
;
;todo: add timer stuff to really measure somethin
; add memdump/save instead of array()
; add gui
;history
; done timing support
; seems like we are shipping this version!
; 08.DEC.2019
INCDIR "BlitzINC:src/"
XINCLUDE"profiler_v06.bb"
;#############################################################
;CONTENS
;#bb__profilerON =1 ;0=OFF
;#bb__PRO_maxfuncs=100
;Macro bbPRO_EntryFunc ; {uniqueidname, display name of func}
;Macro bbPRO_ExitFunc
;Macro ProfilerStatsCLI
;including timer
;Macro bbPRO_EntryFuncT ; {uniqueidname, display name of func}
;Macro bbPRO_ExitFuncT
;
;#############################################################
.setup
#bb__profilerON = 1
.
.Test_Case
._testfunc
Statement testfunc1 {}
!bbPRO_EntryFuncT{tfunc1,"STAT: testfunc1"}
;---this is the original funcs routine--------------
NOP
Delay_5
;---------------------------------------------------
!bbPRO_ExitFuncT
End Statement
Statement testfunc2 {}
!bbPRO_EntryFuncT{tfunc2,"STAT: testfunc2"}
;---this is the original funcs routine--------------
NOP
Delay_5
;---------------------------------------------------
!bbPRO_ExitFuncT
End Statement
.main
CNIF #bb__profilerON
bb_pro_starttimer{}
CEND
For a=1 To 5 ;runs our testfunction 5 times
testfunc1{}
Next a
testfunc2{} ;runs only one time
CNIF #bb__profilerON
!ProfilerStatsCLI ;put out statistics
; For a=1To 10
; NPrint "Time out:", bb_pro_gettime{}
; Delay_5
; Next
CEND
NPrint "click mouse"
MouseWait
|
|
|
Argument in String Parsing, rekursiv |
Geschrieben von: hackball - 10.11.2019, 20:20 - Forum: Snippets & Libraries
- Keine Antworten
|
 |
Ich habe mal ein simples Beispiel vorbereitet, das einzelne Teile aus einem String herauslöst. Man kann das z.B. benutzen als Argumentparser, Wortzähler usw..
Es nutzt hier nur Leerzeichen als Trenner, man kann das aber natürlich anpassen auf ganze Strings von Worttrennern, wenn man will.
Code: ;CMD parse test by f.brandis
;
DEFTYPE.w
;parsetest cmds
cmd$="dump from %s to %d a b cde 4 6 jj m , . ."
NPrint ">",cmd$,"<"
Function.w stripnparse{inp$} ;recursive!
SHARED nums
inp$=StripLead$(inp$,32) ;strip leading SPC
If inp$="" Then Function Return0 ;nothing left!
spc1.w=Instr(inp$," ") ;another separator?
If spc1>1 ;any SPC at the end of this inp$?
arg1$=Mid$(inp$,spc1)
out$ =Left$(inp$,spc1-1)
Gosub _strpnprsprt
ok=stripnparse{arg1$} ;down the rabbit hole...
Else ;rest is an arg.
out$=inp$
Gosub _strpnprsprt
EndIf
Function Return nums ;global count
_strpnprsprt:
nums+1
NPrint "Arg"+Str$(nums)+": >",out$,"<"
Return
End Function
NPrint "#args: ",stripnparse{cmd$}
MouseWait
End
CloseEd
|
|
|
Lemmings-like multi-obj |
Geschrieben von: hackball - 19.10.2019, 01:45 - Forum: Snippets & Libraries
- Keine Antworten
|
 |
Hier mal ein Beispiel für eine Multi-Objekt (lemmings-like) Verwaltung(sehr simpel!).
WTF Wo ist mein Anhang?? Warum kann ich kein LHA anhängen??
Code: ;My Own Lemmings!!!!!
;-By F.Brandis
WBStartup:NoCli:CloseEd
BitMap1,320,256,4:BitMap0,320,256,4
dr$="blitzinc:_dat/"
LoadShapes0,dr$+"Lemms.shp"
dr$="blitzinc:_dat/iff/"
LoadBitMap0,dr$+"LemLev_b.iff",0
dr$="blitzinc:_dat/sfx/"
LoadSound0,dr$+"Lemm-Letsgo.sfx"
LoadSound1,dr$+"Lemm-Aehh!.sfx"
CopyBitMap0,1
VWait50
BLITZ
Slice0,44,4
Show0:Use Palette0
NEWTYPE.lemming
lemx.w
lemy.w
lemm.b ;frame
dir.b
fall.b
bcount.b ;new: bouncecount
End NEWTYPE
DEFTYPE.w
lan.b=40
Dim List l.lemming(lan)
USEPATH l()
While AddItem(l())
Gosub randomlem
Wend
Buffer0,(lan+1)*50*5
Buffer1,(lan+1)*50*5
Sound0,15
Repeat
Show db.b:db=1-db:Use BitMap db
VWait:UnBuffer db
;o.b+1:If o>100Then Sound1,15:o=0
ResetList l()
While NextItem(l())
If Point(\lemx,\lemy+5)<4
\lemy+2
If \fall=3
\lemm+1
If \lemm<18
\lemm=18
Else
If \lemm>21Then \lemm=18
EndIf
Else
\fall+1
EndIf
Else
\fall=0
Select \dir
Case1
\lemm+1:If \lemm>8Then \lemm=0
If Point(\lemx+2,\lemy)>3 ;boing! hit wall
If Point(\lemx+2,\lemy-1)=0
\lemy-2
If Point(\lemx+2,\lemy)>0
\lemy-2
EndIf
Else
\dir=2:\lemx-2
\bcount+1
EndIf
Else
\lemx+1
EndIf
Case2
\lemm-1
If \lemm<9
\lemm=17
Else
If \lemm>17 Then \lemm=17
EndIf
If Point(\lemx-2,\lemy)>3 ;boing! hit wall
If Point(\lemx-2,\lemy-1)=0
\lemy-2
If Point(\lemx+2,\lemy)>0
\lemy-2
EndIf
Else
\dir=1:\lemx+2
\bcount+1
EndIf ;boing-handle
Else
\lemx-1
EndIf
Default
Gosub randomlem
End Select
EndIf
BBlit db,\lemm,\lemx,\lemy
If \bcount>4 Then Gosub bc_handle
If \lemy>200OR \lemx>310OR \lemx<10Then Gosub randomlem; KillItem l()
Wend
Until Joyb(0)>0
End
bc_handle:
\bcount=0
Gosub randomlem
Return
randomlem:
\lemm=0
\lemx=Rnd(300)+10
\lemy=5
rd.b=1-rd
\dir=rd+1
Return
OldLemmsTest.lha.zip (Größe: 27,81 KB / Downloads: 1362)
|
|
|
|