[squeak-dev] Squeak 5 will run on Rasberry Pi OOTB

Herbert König herbertkoenig at gmx.net
Fri Jul 24 19:50:31 UTC 2015


Thanks for the pointers.


Am 24.07.2015 um 17:31 schrieb Chris Muller:
>> When I play with that list filtering at some point the CPU goes up to 90%
>> and does not return until I shut down the image.
> How to reproduce?
>
>
By now I think the high CPU has nothing to do with list filtering but 
either with the new inspector or with not enough Umph of the Pi.

To reproduce, file in the attached class, from a Browser get a sample 
instance.

In that inspector click on "all inst vars". Maybe I have too many too 
big arrays  but it hasn't returned from 96% CPU since a quarter of an hour.

With that knowledge I checked the same in a 4.5 Image running on the VM 
that comes with the Pi. It shows the same problem.

So it's not a 5.0 or 4.6 issue. Sorry for the noise.

OTOH on my Windows laptop the same test is instantaneous. Which means it 
is over a Factor 1000 slower on the ARM V6. I seem to remember the Pi 
being a factor of 70 slower than this laptop.

Cheers,

Herbert
-------------- next part --------------
'From Squeak5.0 of 20 July 2015 [latest update: #15110] on 24 July 2015 at 9:13:09 pm'!
Object subclass: #PictureCompare
	instanceVariableNames: 'pict1 pict2 rectSize rectangles sideRectangles rectanglesWorld compareResults regions compareAveraged oldAveraged longAverages changeTallys numAverages numLongAverages quotients aboveThreshold threshold pict1DominantColors pict2DominantColors emptyGardens state possibleCats savedAverages gpio irLight darkLight'
	classVariableNames: ''
	poolDictionaries: ''
	category: 'hk-PictureAnalyse'!

!PictureCompare methodsFor: 'analyzing' stamp: 'hk 7/23/2015 06:13'!
analyzeCameraQuarter
	"take one image after the other and analyze each pair of consecutive pictures. 
	If Motion detected saveimage2.
	use quarter camera resolution, no Display, 15 secs between images.
	cameraOptionsLight and -Dark changed these set picture resolution"
	|proc alarms pictureFolder folderName i outString drawing|
	self initGPIO.
	rectSize := 18 at 18.
	self waitKillTimelapse.
	darkLight := self lightSensorState.
	proc := self startTimelapse.
	pictureFolder := self getRamdisk.
	folderName := pictureFolder pathName, '/'.
	drawing := true.
	self initializePic1: pictureFolder.
	self initResultArraysQuarter.
	alarms := 0. i := 0.
	state := #emptyGarden.
	[true] whileTrue: [|max pict2Copy|
		i := i + 1.
		self getPict2From: pictureFolder folderName: folderName.
		pict2Copy := pict2 deepCopy.
		self pict2As16Bit.
		"in the hope that outlines will suffer less from differences in brightness or color"
		self shift: pict2 by: 4 at 4.
		"pict2Copy displayOn: Display."
		"self drawPict2."
		self compare; doAverages: i.
		max := quotients max.
		alarms := self doAlarm: alarms max: max runs: i save: pict2Copy.

		"drawing ifTrue: 
			[self drawOverlaidRectangles.
			(Delay forMilliseconds: 600) wait.
			World doOneCycle]."
		
		"(drawing and: [numLongAverages > 0])  ifTrue: [
			self drawLongAverages.
			self drawBinary: longAverages on: Display]."
		"restart Raspistill with other exposure options 
		if we changed between darkness and daylight"
		proc := self handleDarkLight: i process: proc.

		"Sensor redButtonPressed ifTrue: [drawing := drawing not]." "linke Maus"
		Sensor blueButtonPressed ifTrue: [Display restore. 0 halt]. "Mausrad"
		outString := Character cr asString,  i printString, ' Max ', (max printShowingDecimalPlaces: 3),
		 ' alarms ', alarms printString.
		Transcript show: outString.

		pict1 := pict2.
		oldAveraged := compareAveraged copy.
		proc := self checkAndRestartTimelapseProcess: proc.
		World doOneCycle]! !


!PictureCompare methodsFor: 'initialize-release' stamp: 'hk 7/24/2015 21:07'!
initRectanglesWorld
	
	rectanglesWorld := rectangles collect: [:rect| |p1 p2|
		p1 := rect origin.
		p2 := rect corner.
		p1 corner: p2]
	
	! !

!PictureCompare methodsFor: 'initialize-release' stamp: 'hk 7/24/2015 21:06'!
initResultArraysQuarter
	"can only be done after the first picture loaded"
	|x y maxx maxy stepx stepy|
	maxx := 1296.
	maxy := 972.
	stepx := rectSize x.
	stepy := rectSize y.
	rectangles := OrderedCollection new: 72 * 54. "Quarter size x*y /18 / 18"
	x := 0. y := 0.
	[y < maxy] whileTrue: [|xy "x1y" rect "rect1"|
		[x < maxx] whileTrue: [
			xy := x at y.
			rect := xy extent: rectSize.
			rectangles add: rect.
			x:= x + stepx].
		y := y + stepy.
		x := 0].
	rectangles := rectangles asArray.
	compareResults := Array new: rectangles size withAll: 0.
	compareAveraged := Array new: rectangles size withAll: 500.0.
	oldAveraged := compareAveraged copy.
	longAverages := Array new: rectangles size withAll: 100.0.
	savedAverages ifNil: [savedAverages := Dictionary new].
	pict1DominantColors := Array new: rectangles size.
	pict2DominantColors := Array new: rectangles size.
	emptyGardens := OrderedCollection new.
	quotients := Array new: rectangles size withAll: 10.0.
	changeTallys := Array new: rectangles size withAll: 2.5.
	self initRectanglesWorld.! !

!PictureCompare methodsFor: 'initialize-release' stamp: 'hk 7/24/2015 21:12'!
initialize
pict1 := Form extent: 1296 at 972.
pict2 := pict1 deepCopy.
darkLight := #dark.
rectSize := 18 at 18.
numAverages := 18.
numLongAverages := 500.
threshold := 4.4.
state := #starting.
self initResultArraysQuarter! !


More information about the Squeak-dev mailing list