[Cuis-dev] [IMPROV] Ups I did it again: TimeProfileBrowser in Compiler

Gerald Klix cuis.01 at klix.ch
Sat Jun 19 07:12:33 PDT 2021


Hi all, Hi Juan,

I also added the TimeProfileBrowser to
Compiler>>#evaluateSelectionAndDo:ifFail:profiled: .

BTW:
We should improve discoverability in Cuis.
Now more than 2 and a half years have passed,
that you added me as a Cuis developer,
but it took (me) til yesterday, until I discovered
this TimeProfileBrowser class.


HTH and Best Regards,

Gerald
-------------- next part --------------
'From Haver 5.0 [latest update: #4641] on 19 June 2021 at 3:50:44 pm'!

Modules newEnvironment: #DemoWorlds!
Modules newEnvironment: #Worlds!
Modules newEnvironment: #PlanE!
Modules newEnvironment: #Transactions!
Modules newEnvironment: #PlanETest!
!Compiler methodsFor: 'public access' stamp: 'KLG 6/19/2021 15:45:45'!
evaluateMethod: method to: receiver logged: doLog profiled: doProfile
	
	"See evaluate:in:to:notifying:ifFail:logged:profiled:
	It does the same but without compiling because it recevies the result of the compilation 
	as the parameter method. 
	self should have compile method"

	| value toLog itsSelection itsSelectionString |
	
	"(jmv) Log before evaluating. This way, if the evaluation is halted by whatever reason, it is logged anyway"
	doLog ifTrue: [
		toLog _ ((requestor respondsTo: #selection)  
			and: [ (itsSelection _ requestor selection) notNil
			and: [ (itsSelectionString _ itsSelection asString) isEmptyOrNil not ]])
				ifTrue: [ itsSelectionString ]
				ifFalse: [ sourceStream contents ].
		SystemChangeNotifier uniqueInstance evaluated: toLog context: context ].

	"Evaluate now."
	doProfile
		ifTrue: [
			TimeProfileBrowser onBlock: [
				value _ receiver
					withArgs: (context ifNil: [#()] ifNotNil: [{context}])
					executeMethod: method ]]
		ifFalse: [
			value _ receiver
				withArgs: (context ifNil: [#()] ifNotNil: [{context}])
				executeMethod: method ].

	^ value! !



More information about the Cuis-dev mailing list