Win32OperatingSystem.st
branchjv
changeset 18067 27352a7171ab
parent 18066 89d51443ba6f
parent 15414 d5fb5ac0d992
child 18071 009cf668b0ed
--- a/Win32OperatingSystem.st	Mon Jun 10 17:32:35 2013 +0100
+++ b/Win32OperatingSystem.st	Fri Jun 21 19:04:37 2013 +0100
@@ -12226,157 +12226,157 @@
 
     //iterate all following objetcs
     for (objectIterator=0; objectIterator<numObjectTypes; objectIterator++) {
-	//add the st_perObject dictionary to st_objectArray
-	st_perObject = __SSEND0(@global(Dictionary), @symbol(new), 0);
-	__AT_PUT_(st_objectArray, __mkSmallInteger(objectIterator+1), st_perObject);
-
-	//get the object data
-	__AT_PUT_(st_perObject, @symbol(ObjectNameTitleIndex), __mkSmallInteger(perfObjectPtr->ObjectNameTitleIndex));
-	__AT_PUT_(st_perObject, @symbol(DetailLevel), __mkSmallInteger(perfObjectPtr->DetailLevel));
-	__AT_PUT_(st_perObject, @symbol(NumCounters), __mkSmallInteger(perfObjectPtr->NumCounters));
-	__AT_PUT_(st_perObject, @symbol(NumInstances), __mkSmallInteger(perfObjectPtr->NumInstances));
-
-	//setup counter array and initialize its pointer
-	st_counterArray = __ARRAY_NEW_INT(perfObjectPtr->NumCounters);
-	perfCounterPtr = (PERF_COUNTER_DEFINITION *)((char *)perfObjectPtr + perfObjectPtr->HeaderLength);
-
-	//add the st_counterArray to st_perObject dictionary
-	__AT_PUT_(st_perObject, @symbol(Counters), st_counterArray);
-
-	//iterate all following counter definition
-	for (counterIterator=0; counterIterator<perfObjectPtr->NumCounters; counterIterator++) {
-	    //add the st_perCounter dictionary to st_counterArray
-	    st_perCounter = __SSEND0(@global(Dictionary), @symbol(new), 0);
-	    __AT_PUT_(st_counterArray, __mkSmallInteger(counterIterator+1), st_perCounter);
-
-	    //get the counter data
-	    __AT_PUT_(st_perCounter, @symbol(CounterNameTitleIndex), __mkSmallInteger(perfCounterPtr->CounterNameTitleIndex));
-	    __AT_PUT_(st_perCounter, @symbol(CounterTypeBits), __mkSmallInteger(perfCounterPtr->CounterType));
-	    __AT_PUT_(st_perCounter, @symbol(CounterSize), __mkSmallInteger(perfCounterPtr->CounterSize));
-	    __AT_PUT_(st_perCounter, @symbol(CounterOffset), __mkSmallInteger(perfCounterPtr->CounterOffset));
-
-	    //put the counter type size
-	    switch (perfCounterPtr->CounterType & PERF_SIZE_MASK) {
-		case PERF_SIZE_DWORD:
-		    __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(DWORD));
-		    break;
-		case PERF_SIZE_LARGE:
-		    __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(LARGE));
-		    break;
-		case PERF_SIZE_ZERO:
-		    __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(ZERO));
-		    break;
-		case PERF_SIZE_VARIABLE_LEN:
-		    __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(VARIABLE_LEN));
-		    break;
-	    }
-	    switch (perfCounterPtr->CounterType & PERF_TYPE_MASK) {
-		case PERF_TYPE_NUMBER:
-		    __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(NUMBER));
-		    switch (perfCounterPtr->CounterType & PERF_NUMBERTYPE_MASK) {
-			case PERF_NUMBER_HEX:
-			    __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(HEX));
-			    break;
-			case PERF_NUMBER_DECIMAL:
-			    __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(DECIMAL));
-			    break;
-			case PERF_NUMBER_DEC_1000:
-			    __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(DEC_1000));
-			    break;
-		    }
-		    break;
-		case PERF_TYPE_COUNTER:
-		    __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(COUNTER));
-		    switch (perfCounterPtr->CounterType & PERF_COUNTERTYPE_MASK) {
-			case PERF_COUNTER_VALUE:
-			    __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(VALUE));
-			    break;
-			case PERF_COUNTER_RATE:
-			    __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(RATE));
-			    break;
-			case PERF_COUNTER_FRACTION:
-			    __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(FRACTION));
-			    break;
-			case PERF_COUNTER_BASE:
-			    __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(BASE));
-			    break;
-			case PERF_COUNTER_ELAPSED:
-			    __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(ELAPSED));
-			    break;
-			case PERF_COUNTER_QUEUELEN:
-			    __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(QUEUELEN));
-			    break;
-			case PERF_COUNTER_HISTOGRAM:
-			    __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(HISTOGRAM));
-			    break;
+        //add the st_perObject dictionary to st_objectArray
+        st_perObject = __SSEND0(@global(Dictionary), @symbol(new), 0);
+        __AT_PUT_(st_objectArray, __mkSmallInteger(objectIterator+1), st_perObject);
+
+        //get the object data
+        __AT_PUT_(st_perObject, @symbol(ObjectNameTitleIndex), __mkSmallInteger(perfObjectPtr->ObjectNameTitleIndex));
+        __AT_PUT_(st_perObject, @symbol(DetailLevel), __mkSmallInteger(perfObjectPtr->DetailLevel));
+        __AT_PUT_(st_perObject, @symbol(NumCounters), __mkSmallInteger(perfObjectPtr->NumCounters));
+        __AT_PUT_(st_perObject, @symbol(NumInstances), __mkSmallInteger(perfObjectPtr->NumInstances));
+
+        //setup counter array and initialize its pointer
+        st_counterArray = __ARRAY_NEW_INT(perfObjectPtr->NumCounters);
+        perfCounterPtr = (PERF_COUNTER_DEFINITION *)((char *)perfObjectPtr + perfObjectPtr->HeaderLength);
+
+        //add the st_counterArray to st_perObject dictionary
+        __AT_PUT_(st_perObject, @symbol(Counters), st_counterArray);
+
+        //iterate all following counter definition
+        for (counterIterator=0; counterIterator<perfObjectPtr->NumCounters; counterIterator++) {
+            //add the st_perCounter dictionary to st_counterArray
+            st_perCounter = __SSEND0(@global(Dictionary), @symbol(new), 0);
+            __AT_PUT_(st_counterArray, __mkSmallInteger(counterIterator+1), st_perCounter);
+
+            //get the counter data
+            __AT_PUT_(st_perCounter, @symbol(CounterNameTitleIndex), __mkSmallInteger(perfCounterPtr->CounterNameTitleIndex));
+            __AT_PUT_(st_perCounter, @symbol(CounterTypeBits), __mkSmallInteger(perfCounterPtr->CounterType));
+            __AT_PUT_(st_perCounter, @symbol(CounterSize), __mkSmallInteger(perfCounterPtr->CounterSize));
+            __AT_PUT_(st_perCounter, @symbol(CounterOffset), __mkSmallInteger(perfCounterPtr->CounterOffset));
+
+            //put the counter type size
+            switch (perfCounterPtr->CounterType & PERF_SIZE_MASK) {
+                case PERF_SIZE_DWORD:
+                    __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(DWORD));
+                    break;
+                case PERF_SIZE_LARGE:
+                    __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(LARGE));
+                    break;
+                case PERF_SIZE_ZERO:
+                    __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(ZERO));
+                    break;
+                case PERF_SIZE_VARIABLE_LEN:
+                    __AT_PUT_(st_perCounter, @symbol(SIZE),@symbol(VARIABLE_LEN));
+                    break;
+            }
+            switch (perfCounterPtr->CounterType & PERF_TYPE_MASK) {
+                case PERF_TYPE_NUMBER:
+                    __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(NUMBER));
+                    switch (perfCounterPtr->CounterType & PERF_NUMBERTYPE_MASK) {
+                        case PERF_NUMBER_HEX:
+                            __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(HEX));
+                            break;
+                        case PERF_NUMBER_DECIMAL:
+                            __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(DECIMAL));
+                            break;
+                        case PERF_NUMBER_DEC_1000:
+                            __AT_PUT_(st_perCounter, @symbol(NUMBER),@symbol(DEC_1000));
+                            break;
+                    }
+                    break;
+                case PERF_TYPE_COUNTER:
+                    __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(COUNTER));
+                    switch (perfCounterPtr->CounterType & PERF_COUNTERTYPE_MASK) {
+                        case PERF_COUNTER_VALUE:
+                            __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(VALUE));
+                            break;
+                        case PERF_COUNTER_RATE:
+                            __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(RATE));
+                            break;
+                        case PERF_COUNTER_FRACTION:
+                            __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(FRACTION));
+                            break;
+                        case PERF_COUNTER_BASE:
+                            __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(BASE));
+                            break;
+                        case PERF_COUNTER_ELAPSED:
+                            __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(ELAPSED));
+                            break;
+                        case PERF_COUNTER_QUEUELEN:
+                            __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(QUEUELEN));
+                            break;
+                        case PERF_COUNTER_HISTOGRAM:
+                            __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(HISTOGRAM));
+                            break;
 #ifdef PERF_COUNTER_PRECISION
-			case PERF_COUNTER_PRECISION:
-			    __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(PRECISION));
-			    break;
-#endif
-		    }
-		    break;
-		case PERF_TYPE_TEXT:
-		    __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(TEXT));
-		    switch (perfCounterPtr->CounterType & PERF_TEXTTYPE_MASK) {
-			case PERF_TEXT_UNICODE:
-			    __AT_PUT_(st_perCounter, @symbol(TEXT),@symbol(UNICODE));
-			    break;
-			case PERF_TEXT_ASCII:
-			    __AT_PUT_(st_perCounter, @symbol(TEXT),@symbol(ASCII));
-			    break;
-		    }
-		    break;
-		case PERF_TYPE_ZERO:
-		    __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(ZERO));
-		    break;
-	    }
-
-	    //setup the counter pointer to the next counter definition
-	    perfCounterPtr = (PERF_COUNTER_DEFINITION *)((char *)perfCounterPtr + perfCounterPtr->ByteLength);
-	}
-
-	//goon dependent on the count of instances
-	if (perfObjectPtr->NumInstances < 1) {
-	    perfCounterBlockPtr = (PERF_COUNTER_BLOCK *)(perfCounterPtr);
-	    __AT_PUT_(st_perObject, @symbol(RawData), __MKBYTEARRAY(perfCounterBlockPtr, perfCounterBlockPtr->ByteLength));
-	} else {
-	    //setup the instance pointer to the end of all counters
-	    perfInstancePtr = (PERF_INSTANCE_DEFINITION *)(perfCounterPtr);
-
-	    //setup st_instanceArray and add it to st_perObject
-	    st_instanceArray = __ARRAY_NEW_INT(perfObjectPtr->NumInstances);
-	    __AT_PUT_(st_perObject, @symbol(Instances), st_instanceArray);
-
-	    //iterate the instances
-	    for (instanceIterator=0; instanceIterator<perfObjectPtr->NumInstances; instanceIterator++) {
-		//setup st_perInstance and add it to st_instanceArray
-		st_perInstance = __SSEND0(@global(Dictionary), @symbol(new), 0);
-		__AT_PUT_(st_instanceArray, __mkSmallInteger(instanceIterator+1), st_perInstance);
-
-		//get the instance data
-		__AT_PUT_(st_perInstance, @symbol(Name), __MKBYTEARRAY((wchar_t *)((BYTE *)perfInstancePtr + perfInstancePtr->NameOffset),perfInstancePtr->NameLength));
-		__AT_PUT_(st_perInstance, @symbol(ParentObjectTitleIndex), __mkSmallInteger(perfInstancePtr->ParentObjectTitleIndex));
-		__AT_PUT_(st_perInstance, @symbol(ParentObjectInstance), __mkSmallInteger(perfInstancePtr->ParentObjectInstance));
-		__AT_PUT_(st_perInstance, @symbol(NameOffset), __mkSmallInteger(perfInstancePtr->NameOffset));
-		__AT_PUT_(st_perInstance, @symbol(NameLength), __mkSmallInteger(perfInstancePtr->NameLength));
-
-		//setup the instance pointer to the its end
-		perfInstancePtr = (PERF_INSTANCE_DEFINITION *)((char *)perfInstancePtr + perfInstancePtr->ByteLength);
-
-		//setup the counter block pointer
-		perfCounterBlockPtr = (PERF_COUNTER_BLOCK *)(perfInstancePtr);
-
-		//get the instance raw data
-		__AT_PUT_(st_perInstance, @symbol(RawData), __MKBYTEARRAY(perfCounterBlockPtr, perfCounterBlockPtr->ByteLength));
-
-		//setup the instance pointer to the next instance
-		perfInstancePtr = (PERF_INSTANCE_DEFINITION *)((char *)perfCounterBlockPtr + perfCounterBlockPtr->ByteLength);
-	    }
-	}
-
-	//setup the object pointer to the next object
-	perfObjectPtr = (PERF_OBJECT_TYPE *)((char *)perfObjectPtr + perfObjectPtr->TotalByteLength);
+                        case PERF_COUNTER_PRECISION:
+                            __AT_PUT_(st_perCounter, @symbol(COUNTER),@symbol(PRECISION));
+                            break;
+#endif
+                    }
+                    break;
+                case PERF_TYPE_TEXT:
+                    __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(TEXT));
+                    switch (perfCounterPtr->CounterType & PERF_TEXTTYPE_MASK) {
+                        case PERF_TEXT_UNICODE:
+                            __AT_PUT_(st_perCounter, @symbol(TEXT),@symbol(UNICODE));
+                            break;
+                        case PERF_TEXT_ASCII:
+                            __AT_PUT_(st_perCounter, @symbol(TEXT),@symbol(ASCII));
+                            break;
+                    }
+                    break;
+                case PERF_TYPE_ZERO:
+                    __AT_PUT_(st_perCounter, @symbol(TYPE),@symbol(ZERO));
+                    break;
+            }
+
+            //setup the counter pointer to the next counter definition
+            perfCounterPtr = (PERF_COUNTER_DEFINITION *)((char *)perfCounterPtr + perfCounterPtr->ByteLength);
+        }
+
+        //goon dependent on the count of instances
+        if (perfObjectPtr->NumInstances < 1) {
+            perfCounterBlockPtr = (PERF_COUNTER_BLOCK *)(perfCounterPtr);
+            __AT_PUT_(st_perObject, @symbol(RawData), __MKBYTEARRAY(perfCounterBlockPtr, perfCounterBlockPtr->ByteLength));
+        } else {
+            //setup the instance pointer to the end of all counters
+            perfInstancePtr = (PERF_INSTANCE_DEFINITION *)(perfCounterPtr);
+
+            //setup st_instanceArray and add it to st_perObject
+            st_instanceArray = __ARRAY_NEW_INT(perfObjectPtr->NumInstances);
+            __AT_PUT_(st_perObject, @symbol(Instances), st_instanceArray);
+
+            //iterate the instances
+            for (instanceIterator=0; instanceIterator<perfObjectPtr->NumInstances; instanceIterator++) {
+                //setup st_perInstance and add it to st_instanceArray
+                st_perInstance = __SSEND0(@global(Dictionary), @symbol(new), 0);
+                __AT_PUT_(st_instanceArray, __mkSmallInteger(instanceIterator+1), st_perInstance);
+
+                //get the instance data
+                __AT_PUT_(st_perInstance, @symbol(Name), __MKBYTEARRAY((wchar_t *)((BYTE *)perfInstancePtr + perfInstancePtr->NameOffset),perfInstancePtr->NameLength));
+                __AT_PUT_(st_perInstance, @symbol(ParentObjectTitleIndex), __mkSmallInteger(perfInstancePtr->ParentObjectTitleIndex));
+                __AT_PUT_(st_perInstance, @symbol(ParentObjectInstance), __mkSmallInteger(perfInstancePtr->ParentObjectInstance));
+                __AT_PUT_(st_perInstance, @symbol(NameOffset), __mkSmallInteger(perfInstancePtr->NameOffset));
+                __AT_PUT_(st_perInstance, @symbol(NameLength), __mkSmallInteger(perfInstancePtr->NameLength));
+
+                //setup the instance pointer to the its end
+                perfInstancePtr = (PERF_INSTANCE_DEFINITION *)((char *)perfInstancePtr + perfInstancePtr->ByteLength);
+
+                //setup the counter block pointer
+                perfCounterBlockPtr = (PERF_COUNTER_BLOCK *)(perfInstancePtr);
+
+                //get the instance raw data
+                __AT_PUT_(st_perInstance, @symbol(RawData), __MKBYTEARRAY(perfCounterBlockPtr, perfCounterBlockPtr->ByteLength));
+
+                //setup the instance pointer to the next instance
+                perfInstancePtr = (PERF_INSTANCE_DEFINITION *)((char *)perfCounterBlockPtr + perfCounterBlockPtr->ByteLength);
+            }
+        }
+
+        //setup the object pointer to the next object
+        perfObjectPtr = (PERF_OBJECT_TYPE *)((char *)perfObjectPtr + perfObjectPtr->TotalByteLength);
     }
 %}.
     objectArray := st_objectArray.
@@ -12385,61 +12385,61 @@
     perfTime100nSec := st_perfTime100nSec.
 
     getNameBlock := [:i|
-	self class counterIndexTextDictionary at:i ifAbsent:['<<no name>>'].
+        self class counterIndexTextDictionary at:i ifAbsent:['<<no name>>'].
     ].
 
     getCounterValueBlock := [:counter :rawData|
-	|offset counterValue|
-
-	offset := counter at:#CounterOffset.
-	offset >= rawData size ifTrue:[
-	    counterValue := nil.
-	] ifFalse:[
-	    (counter at:#SIZE) == #LARGE ifTrue:[
-		counterValue := rawData unsignedLongLongAt:offset + 1 bigEndian:false.
-	    ] ifFalse:[
-		(counter at:#SIZE) == #DWORD ifTrue:[
-		    counterValue := rawData unsignedLongAt:offset + 1 bigEndian:false.
-		] ifFalse:[
-		    self halt.
-		].
-	    ].
-	].
-
-	counterValue
+        |offset counterValue|
+
+        offset := counter at:#CounterOffset.
+        offset >= rawData size ifTrue:[
+            counterValue := nil.
+        ] ifFalse:[
+            (counter at:#SIZE) == #LARGE ifTrue:[
+                counterValue := rawData unsignedLongLongAt:offset + 1 bigEndian:false.
+            ] ifFalse:[
+                (counter at:#SIZE) == #DWORD ifTrue:[
+                    counterValue := rawData unsignedLongAt:offset + 1 bigEndian:false.
+                ] ifFalse:[
+                    self halt:'unhandled counter-size; please check'.
+                ].
+            ].
+        ].
+
+        counterValue
     ].
 
     objectArray do:[:anObject|
-	"setup the object name"
-	anObject at:#ObjectNameTitle put:(getNameBlock value:(anObject at:#ObjectNameTitleIndex)).
-
-	"setup the name and a counter value array to each counter"
-	(anObject at:#Counters) do:[:aCounter|
-	    aCounter at:#CounterNameTitle put:(getNameBlock value:(aCounter at:#CounterNameTitleIndex)).
-	    aCounter at:#CounterValueArray put:OrderedCollection new.
-	].
-
-	(anObject at:#NumInstances) < 1 ifTrue:[
-	    |rawData|
-
-	    rawData := anObject at:#RawData.
-
-	    (anObject at:#Counters) do:[:aCounter|
-		(aCounter at:#CounterValueArray) add:(getCounterValueBlock value:aCounter value:rawData).
-	    ].
-	] ifFalse:[
-	    (anObject at:#Instances) do:[:anInstance|
-		|rawData|
-
-		rawData := anInstance at:#RawData.
-
-		anInstance at:#Name put:((Unicode16String fromBytes:(anInstance at:#Name) copy swapBytes) copyButLast:1).
-
-		(anObject at:#Counters) do:[:aCounter|
-		    (aCounter at:#CounterValueArray) add:(getCounterValueBlock value:aCounter value:rawData).
-		].
-	    ].
-	].
+        "setup the object name"
+        anObject at:#ObjectNameTitle put:(getNameBlock value:(anObject at:#ObjectNameTitleIndex)).
+
+        "setup the name and a counter value array to each counter"
+        (anObject at:#Counters) do:[:aCounter|
+            aCounter at:#CounterNameTitle put:(getNameBlock value:(aCounter at:#CounterNameTitleIndex)).
+            aCounter at:#CounterValueArray put:OrderedCollection new.
+        ].
+
+        (anObject at:#NumInstances) < 1 ifTrue:[
+            |rawData|
+
+            rawData := anObject at:#RawData.
+
+            (anObject at:#Counters) do:[:aCounter|
+                (aCounter at:#CounterValueArray) add:(getCounterValueBlock value:aCounter value:rawData).
+            ].
+        ] ifFalse:[
+            (anObject at:#Instances) do:[:anInstance|
+                |rawData|
+
+                rawData := anInstance at:#RawData.
+
+                anInstance at:#Name put:((Unicode16String fromBytes:(anInstance at:#Name) copy swapBytes) copyButLast:1).
+
+                (anObject at:#Counters) do:[:aCounter|
+                    (aCounter at:#CounterValueArray) add:(getCounterValueBlock value:aCounter value:rawData).
+                ].
+            ].
+        ].
     ].
 
     ^ self
@@ -17136,15 +17136,15 @@
 !Win32OperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.466 2013-06-06 11:02:00 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.467 2013-06-20 22:33:31 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.466 2013-06-06 11:02:00 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.467 2013-06-20 22:33:31 cg Exp $'
 !
 
 version_SVN
-    ^ '$Id: Win32OperatingSystem.st,v 1.466 2013-06-06 11:02:00 cg Exp $'
+    ^ '$Id: Win32OperatingSystem.st,v 1.467 2013-06-20 22:33:31 cg Exp $'
 
 ! !