[Pkg] The Trunk: System-eem.676.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Jul 18 17:42:35 UTC 2014


Eliot Miranda uploaded a new version of System to project The Trunk:
http://source.squeak.org/trunk/System-eem.676.mcz

==================== Summary ====================

Name: System-eem.676
Author: eem
Time: 18 July 2014, 10:41:47.728 am
UUID: 1f7400d3-bcc1-4c51-8028-b6f98d957bd1
Ancestors: System-nice.675

Fix vmStatisticsReportString for Spur.
Provide Smalltalk vm isRunningSpur.
Improve isRunningCogit & isRunningCog
Extend the comment in vmParameterAt:

=============== Diff against System-nice.675 ===============

Item was changed:
  ----- Method: SmalltalkImage>>isRunningCog (in category 'system attributes') -----
  isRunningCog
+ 	"Answers if we're running on a Cog VM (JIT or StackInterpreter)"
- 	"Returns true if we're running on a Cog VM (JIT or StackInterpreter)
- 	 (vmParameterAt: 42 is the number of stack pages)"
  
+ 	^(self vmParameterAt: 42)
+ 		ifNil: [false]
+ 		ifNotNil: [:numStackPages| numStackPages > 0]!
- 	^[(self vmParameterAt: 42) > 0] on: Error do:[:ex| ex return: false]!

Item was changed:
  ----- Method: SmalltalkImage>>isRunningCogit (in category 'system attributes') -----
  isRunningCogit
+ 	"Answers if we're running on the Cog JIT"
- 	"Returns true if we're running on the Cog JIT
- 	 (vmParameterAt: 46 is the size of the machine code zone)"
  
+ 	^(self vmParameterAt: 46)
+ 		ifNil: [false]
+ 		ifNotNil: [:machineCodeZoneSize| machineCodeZoneSize > 0]!
- 	^[(self vmParameterAt: 46) > 0] on: Error do:[:ex| ex return: false]!

Item was added:
+ ----- Method: SmalltalkImage>>isRunningSpur (in category 'system attributes') -----
+ isRunningSpur
+ 	"Answers if we're running on the Spur memory manager.  Spur has immediate characters.
+ 	 (vmParameterAt: 41 is the image format version for the VM)"
+ 
+ 	^Character instSize = 0
+ 	"a.k.a. (self vmParameterAt: 41) anyMask: 16"!

Item was changed:
  ----- Method: SmalltalkImage>>vmParameterAt: (in category 'system attributes') -----
  vmParameterAt: parameterIndex
+ 	"parameterIndex is a positive integer corresponding to one of the VM's internal parameter/metric registers.
+ 	 Answer with the current value of that register.  Fail if parameterIndex has no corresponding register.
+ 	 VM parameters are numbered as follows:
+ 		1	byte size of old-space (read-only)
+ 		2	byte size of young-space (read-only)
+ 		3	byte size of object memory (read-only)
- 	"parameterIndex is a positive integer corresponding to one of the VM's internal
- 	parameter/metric registers.  Answer with the current value of that register.
- 	Fail if parameterIndex has no corresponding register.
- 	VM parameters are numbered as follows:
- 		1	end of old-space (0-based, read-only)
- 		2	end of young-space (read-only)
- 		3	end of memory (read-only)
  		4	allocationCount (read-only; nil in Cog VMs)
  		5	allocations between GCs (read-write; nil in Cog VMs)
  		6	survivor count tenuring threshold (read-write)
  		7	full GCs since startup (read-only)
  		8	total milliseconds in full GCs since startup (read-only)
+ 		9	incremental GCs since startup (read-only; scavenging GCs on Spur)
+ 		10	total milliseconds in incremental/scavenging GCs since startup (read-only)
- 		9	incremental GCs since startup (read-only)
- 		10	total milliseconds in incremental GCs since startup (read-only)
  		11	tenures of surving objects since startup (read-only)
+ 		12-20 specific to the translating VM (nil in Cog VMs)
- 		12-20 specific to the translating VM
  		21	root table size (read-only)
  		22	root table overflows since startup (read-only)
  		23	bytes of extra memory to reserve for VM buffers, plugins, etc.
+ 		24	memory threshold above which to shrink object memory (read-write)
+ 		25	ammount to grow by when growing object memory (read-write)
- 		24	memory threshold above whichto shrink object memory (read-write)
- 		25	memory headroom when growing object memory (read-write)
  		26	interruptChecksEveryNms - force an ioProcessEvents every N milliseconds (read-write)
  		27	number of times mark loop iterated for current IGC/FGC (read-only) includes ALL marking
  		28	number of times sweep loop iterated for current IGC/FGC (read-only)
  		29	number of times make forward loop iterated for current IGC/FGC (read-only)
  		30	number of times compact move loop iterated for current IGC/FGC (read-only)
  		31	number of grow memory requests (read-only)
  		32	number of shrink memory requests (read-only)
  		33	number of root table entries used for current IGC/FGC (read-only)
  		34	number of allocations done before current IGC/FGC (read-only)
  		35	number of survivor objects after current IGC/FGC (read-only)
  		36	millisecond clock when current IGC/FGC completed (read-only)
  		37	number of marked objects for Roots of the world, not including Root Table entries for current IGC/FGC (read-only)
  		38	milliseconds taken by current IGC (read-only)
  		39	Number of finalization signals for Weak Objects pending when current IGC/FGC completed (read-only)
  		40	BytesPerWord for this image
  		41	imageFormatVersion for the VM
  		42	number of stack pages in use (Cog Stack VM only, otherwise nil)
  		43	desired number of stack pages (stored in image file header, max 65535; Cog VMs only, otherwise nil)
  		44	size of eden, in bytes (Cog VMs only, otherwise nil)
  		45	desired size of eden, in bytes (stored in image file header; Cog VMs only, otherwise nil)
  		46	size of machine code zone, in bytes (stored in image file header; Cog JIT VM only, otherwise nil)
  		47	desired size of machine code zone, in bytes (applies at startup only, stored in image file header; Cog JIT VM only)
  		48	various properties of the Cog VM as an integer encoding an array of bit flags.
+ 			Bit 0: implies the image's Process class has threadId as its 3rd inst var (zero relative)
+ 			Bit 1: on Cog VMs asks the VM to set the flag bit in interpreted methods
+ 			Bit 2: if set, preempting a process puts it to the head of its run queue, not the back,
+ 					i.e. preempting a process by a higher one will not cause the process to yield
+ 						to others at the same priority.
- 			 Bit 0: implies the image's Process class has threadId as its 3rd inst var (zero relative)
  		49	the size of the external semaphore table (read-write; Cog VMs only)
+ 		50-53 reserved for VM parameters that persist in the image (such as eden above)
+ 		54	total size of free old space (Spur only, otherwise nil)
+ 		55	ratio of growth and image size at or above which a GC will be performed post scavenge (Spur only, otherwise nil)
- 		50-55 reserved for VM parameters that persist in the image (such as eden above)
  		56	number of process switches since startup (read-only)
  		57	number of ioProcessEvents calls since startup (read-only)
+ 		58	number of forceInterruptCheck (Cog VMs) or quickCheckInterruptCalls (non-Cog VMs) calls since startup (read-only)
- 		58	number of ForceInterruptCheck (Cog VMs) or quickCheckInterruptCalls (non-Cog VMs) calls since startup (read-only)
  		59	number of check event calls since startup (read-only)
  		60	number of stack page overflows since startup (read-only; Cog VMs only)
  		61	number of stack page divorces since startup (read-only; Cog VMs only)
  		62	number of machine code zone compactions since startup (read-only; Cog VMs only)
  		63	milliseconds taken by machine code zone compactions since startup (read-only; Cog VMs only)
  		64	current number of machine code methods (read-only; Cog VMs only)
  		65	true if the VM supports multiple bytecode sets;  (read-only; Cog VMs only; nil in older Cog VMs)
+ 		66	the byte size of a stack page in the stack zone  (read-only; Cog VMs only)
+ 		67 - 69 reserved for more Cog-related info
  		70	the value of VM_PROXY_MAJOR (the interpreterProxy major version number)
  		71	the value of VM_PROXY_MINOR (the interpreterProxy minor version number)"
  
  	<primitive: 254>
  	self primitiveFailed!

Item was changed:
  ----- Method: SmalltalkImage>>vmStatisticsReportString (in category 'vm statistics') -----
  vmStatisticsReportString
+ 	"(Workspace new contents: Smalltalk vmStatisticsReportString)
+ 		openLabel: 'VM Statistics'"
+ 	"StringHolderView
+ 		open: (StringHolder new contents: Smalltalk vmStatisticsReportString)
+ 		label: 'VM Statistics'"
- 	"StringHolderView open: (StringHolder new contents:
- 		Smalltalk vmStatisticsReportString) label: 'VM Statistics'"
  
+ 	| params onSpur oldSpaceEnd youngSpaceEnd memorySize fullGCs fullGCTime incrGCs incrGCTime tenureCount upTime upTime2 fullGCs2 fullGCTime2 incrGCs2 incrGCTime2 tenureCount2 str freeSize youngSize used |
- 	| params oldSpaceEnd youngSpaceEnd memoryEnd fullGCs fullGCTime incrGCs incrGCTime tenureCount upTime upTime2 fullGCs2 fullGCTime2 incrGCs2 incrGCTime2 tenureCount2 str |
  	params := self getVMParameters.
+ 	onSpur := (params at: 41) anyMask: 16.
  	oldSpaceEnd			:= params at: 1.
  	youngSpaceEnd		:= params at: 2.
+ 	memorySize			:= params at: 3.
- 	memoryEnd			:= params at: 3.
  	fullGCs				:= params at: 7.
  	fullGCTime			:= params at: 8.
  	incrGCs				:= params at: 9.
  	incrGCTime			:= params at: 10.
  	tenureCount			:= params at: 11.
  	upTime := Time millisecondClockValue.
  
+ 	str := WriteStream on: (String new: 700).
- 	str := WriteStream on: (String new: 1000).
  	str	nextPutAll: 'uptime			';
  		print: (upTime / 1000 / 60 // 60); nextPut: $h;
  		print: (upTime / 1000 / 60 \\ 60) asInteger; nextPut: $m;
  		print: (upTime / 1000 \\ 60) asInteger; nextPut: $s; cr.
  
  	str	nextPutAll: 'memory		';
+ 		nextPutAll: memorySize asStringWithCommas; nextPutAll: ' bytes'; cr.
- 		nextPutAll: memoryEnd asStringWithCommas; nextPutAll: ' bytes'; cr.
  	str	nextPutAll:	'	old			';
  		nextPutAll: oldSpaceEnd asStringWithCommas; nextPutAll: ' bytes (';
+ 		print: (oldSpaceEnd / memorySize * 100) maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
+ 	youngSize := onSpur
+ 						ifTrue: [params at: 44 "eden size"] "Spur"
+ 						ifFalse:  [youngSpaceEnd - oldSpaceEnd]. "Squeak V3"
- 		print: (oldSpaceEnd / memoryEnd * 100) maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
  	str	nextPutAll: '	young		';
+ 		nextPutAll: youngSize asStringWithCommas; nextPutAll: ' bytes (';
+ 		print: youngSize / memorySize * 100 maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
+ 	onSpur ifTrue: [youngSize := youngSpaceEnd "used eden"].
+ 	freeSize := onSpur
+ 						ifTrue: [(params at: 54) + (params at: 44) - youngSize] "Spur"
+ 						ifFalse:  [memorySize - youngSpaceEnd] "Squeak V3".
+ 	used := onSpur
+ 				ifTrue: [youngSize + oldSpaceEnd - freeSize] "Spur"
+ 				ifFalse:  [youngSpaceEnd]. "Squeak V3"
- 		nextPutAll: (youngSpaceEnd - oldSpaceEnd) asStringWithCommas; nextPutAll: ' bytes (';
- 		print: (youngSpaceEnd - oldSpaceEnd / memoryEnd * 100) maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
  	str	nextPutAll: '	used		';
+ 		nextPutAll: used asStringWithCommas; nextPutAll: ' bytes (';
+ 		print: used / memorySize * 100 maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
- 		nextPutAll: youngSpaceEnd asStringWithCommas; nextPutAll: ' bytes (';
- 		print: (youngSpaceEnd / memoryEnd * 100) maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
  	str	nextPutAll: '	free		';
+ 		nextPutAll: freeSize asStringWithCommas; nextPutAll: ' bytes (';
+ 		print: freeSize / memorySize * 100 maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
- 		nextPutAll: (memoryEnd - youngSpaceEnd) asStringWithCommas; nextPutAll: ' bytes (';
- 		print: (memoryEnd - youngSpaceEnd / memoryEnd * 100) maxDecimalPlaces: 1; nextPutAll: '%)'; cr.
  
  	str	nextPutAll: 'GCs			';
  		nextPutAll: (fullGCs + incrGCs) asStringWithCommas.
  	fullGCs + incrGCs > 0 ifTrue: [
  		str
  			nextPutAll: ' ('; 
  			print: (upTime / (fullGCs + incrGCs)) maxDecimalPlaces: 1; 
  			nextPutAll: ' ms between GCs)'
  	].
  	str cr.
  	str	nextPutAll: '	full			';
  		nextPutAll: fullGCs asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: fullGCTime asStringWithCommas; nextPutAll: ' ms (';
  		print: (fullGCTime / upTime * 100) maxDecimalPlaces: 1;
  		nextPutAll: '% uptime)'.
  	fullGCs = 0 ifFalse:
  		[str	nextPutAll: ', avg '; print: (fullGCTime / fullGCs) maxDecimalPlaces: 1; nextPutAll: ' ms'].
  	str	cr.
  	str	nextPutAll: '	incr			';
  		nextPutAll: incrGCs asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: incrGCTime asStringWithCommas; nextPutAll: ' ms (';
  		print: (incrGCTime / upTime * 100) maxDecimalPlaces: 1;
  		nextPutAll: '% uptime), avg '; print: (incrGCTime / incrGCs) maxDecimalPlaces: 1; nextPutAll: ' ms'; cr.
  	str	nextPutAll: '	tenures		';
  		nextPutAll: tenureCount asStringWithCommas.
  	tenureCount = 0 ifFalse:
  		[str nextPutAll: ' (avg '; print: incrGCs // tenureCount; nextPutAll: ' GCs/tenure)'].
  	str	cr.
  
  LastStats ifNil: [LastStats := Array new: 6]
  ifNotNil: [
  	upTime2 := upTime - (LastStats at: 1).
  	fullGCs2 := fullGCs - (LastStats at: 2).
  	fullGCTime2 := fullGCTime - (LastStats at: 3).
  	incrGCs2 := incrGCs - (LastStats at: 4).
  	incrGCTime2 := incrGCTime - (LastStats at: 5).
  	tenureCount2 := tenureCount - (LastStats at: 6).
  
  	str	nextPutAll: self textMarkerForShortReport ;
  		nextPutAll: (fullGCs2 + incrGCs2) asStringWithCommas.
  	fullGCs2 + incrGCs2 > 0 ifTrue: [
  		str
  			nextPutAll: ' ('; 
  			print: upTime2 // (fullGCs2 + incrGCs2); 
  			nextPutAll: ' ms between GCs)'.
  	].
  	str cr.
  	str	nextPutAll: '	uptime		'; print: (upTime2 / 1000.0) maxDecimalPlaces: 1; nextPutAll: ' s'; cr.
  	str	nextPutAll: '	full			';
  		nextPutAll: fullGCs2 asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: fullGCTime2 asStringWithCommas; nextPutAll: ' ms (';
  		print: (fullGCTime2 / upTime2 * 100) maxDecimalPlaces: 1;
  		nextPutAll: '% uptime)'.
  	fullGCs2 = 0 ifFalse:
  		[str	nextPutAll: ', avg '; print: (fullGCTime2 / fullGCs2) maxDecimalPlaces: 1; nextPutAll: ' ms'].
  	str	cr.
  	str	nextPutAll: '	incr			';
  		nextPutAll: incrGCs2 asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: incrGCTime2 asStringWithCommas; nextPutAll: ' ms (';
  		print: (incrGCTime2 / upTime2 * 100) maxDecimalPlaces: 1;
  		nextPutAll: '% uptime), avg '.
  	incrGCs2 > 0 ifTrue: [
  		 str print: (incrGCTime2 / incrGCs2) maxDecimalPlaces: 1; nextPutAll: ' ms'
  	].
  	str cr.
  	str	nextPutAll: '	tenures		';
  		nextPutAll: tenureCount2 asStringWithCommas.
  	tenureCount2 = 0 ifFalse:
  		[str nextPutAll: ' (avg '; print: incrGCs2 // tenureCount2; nextPutAll: ' GCs/tenure)'].
  	str	cr.
  ].
  	LastStats at: 1 put: upTime.
  	LastStats at: 2 put: fullGCs.
  	LastStats at: 3 put: fullGCTime.
  	LastStats at: 4 put: incrGCs.
  	LastStats at: 5 put: incrGCTime.
  	LastStats at: 6 put: tenureCount.
  
  	^ str contents
  !



More information about the Packages mailing list