Get Garbage Collector metrics using WMI - windows

I need to collect metrics about the Percent Time in GarbageCollector using WMI Classes for Windows servers. I'm using the Class: "Win32_PerfRawData_NETFramework_NETCLRMemory".
Is this correct?
Then I take two samples for that class and i made the following calculation:
# PSEUDO CODE
PercentTime in GC =
(
(sample2->'PercentTimeinGC' - sample1->'PercentTimeinGC') /
(sample2->'TimeStamp_Sys100NS' - sample1->'TimeStamp_Sys100NS')
)
This calculation is definitively wrong, how to do it in the right way?
Tks in advance.
gulden

After some digging in the unknown world of windows I've found the solution:
I've started with this link that explains the calculation methods for each kind of metric:
http://msdn.microsoft.com/en-us/library/ms974615.aspx
However, we need to know the countertype, in this case the countertype for "PercentTimeinGC". To know that i need to run the WEBMTest.exe program:
http://technet.microsoft.com/en-us/library/cc180684.aspx
Connect to "root\CIMV2"
Open Class... "Win32_PerfRawData_NETFramework_NETCLRMemory"
Select the property "PercentTimeinGC"
Click in the button "Show MOF"
Find the line:
"[DisplayName("% Time in GC"): ToInstance, countertype(537003008): ToInstance, perfindex(2606): ToInstance, helpindex(2607): ToInstance, defaultscale(0): ToInstance, perfdetail(100): ToInstance] uint32 PercentTimeinGC;"
Now that we know the countertype (537003008), you need to map it to a human readable form. This link will help:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa389383(v=vs.85).aspx
The mapping for coutertype 537003008 is PERF_RAW_FRACTION.
We go back for the first link and find the calculation method for PERF_RAW_FRACTION that is:
(100 * CounterValue) / BaseValue
I love windows.
gulden

Related

How do we import the listener events of LibreOffice Writer in Visual Basic 6

How do we import the listener events of LibreOffice writer in Visual Basic 6?
I am trying to create a UNO service to get container listener event like following code,
Dim oListener As Object
oListener = CreateUnoListener("ContListener_",
"com.sun.star.container.XContainerListener")
I am getting an error
Compile error : Sub or Function not defined
Can anyone please help?
As explained here, CreateUnoListener does not work in VB6. So instead, it is necessary to implement the listener interface a different way.
Here is a VBScript example from https://wiki.openoffice.org/wiki/Documentation/DevGuide/OfficeDev/Document_Events.
set xContext = objServiceManager.getPropertyValue( "DefaultContext" )
set xCoreReflection = xContext.getValueByName( "/singletons/com.sun.star.reflection.theCoreReflection" )
set xClass = xCoreReflection.forName( "com.sun.star.document.XEventBroadcaster" )
set xMethod = xClass.getMethod( "addEventListener" )
dim invokeargs(0)
invokeargs(0) = myListener
set value = objServiceManager.Bridge_GetValueObject()
call value.InitInOutParam("[]any", invokeargs)
call xMethod.invoke( objDocument, value )
Define a subroutine called myListener.
It may also help to check out the information at https://www.openoffice.org/udk/common/man/tutorial/office_automation.html.
There is a discussion of someone attempting similar code at https://forum.openoffice.org/en/forum/viewtopic.php?f=45&t=14217, although the final solution uses Javascript.
Disclaimer: I do not have any way to test VB6 code, so this information may not be entirely accurate. If you switch to Python or another language commonly used with LibreOffice then I can be of more help.

Warning- "SAPEdit" description mismatch, " The object was not found using the test object description.Check the object properties

I'm a new entrant to UFT and while i'm trying to access the columns of a webtable, to identify the test object "SAPEdit", UFT takes a longer time and throws a warning "SAPEdit" -description mismatch. The object was not found using the test object description.Check the object's properties. Kindly suggest me a workaround to clear this warning and speed up the test object identification. BTW, i'm not using descriptive programming.
Code follows:
strPENXPath = strTblXPath & "/TBODY[1]/TR[" & iRow & "]/TD[1]/SPAN[1]/INPUT[1]"
Browser("SAP Transaction iView").Page("SAP Transaction iView").SAPFrame("Child Care Quota Program_2").SAPEdit("SAPEdit").SetTOProperty "xpath", strPENXPath
oPersonnelNo = Browser("SAP Transaction iView").Page("SAP Transaction iView").SAPFrame("Child Care Quota Program_2").SAPEdit("SAPEdit").GetROProperty("value")
If iPersonnelNo <> oPersonnelNo Then
strMessage=strMessage & "Failed -Personnelno Type "
End If
This means that the object's description doesn't match an object in your application.
There are several ways to fix this problem.
Probably the simplest one is to Maintenance Run Mode.
From the Run menu select Maintenance Run Mode... then when UFT will see an object it can't find it will ask you to point at the object and then it will suggest a solution.

How do I validate responses with Gauge (getgauge.io)?

I've looked in the documentation and sample C# project: http://getgauge.io/documentation/user/current/
However, I'm not sure how to validate the response from a "Step". Maybe Gauge isn't the right tool for this but I'm trying to validate the format of a JSON response for instance.
On their standard "StepImplementation" class, I can see the following method. I added 'return "blah";' to the end:
[Step("Say <what> to <who>")]
public string SaySomething(string what, string who)
{
Console.WriteLine("{0}, {1}!", what, who);
return "blah";
}
And of course in the spec file:
First scenario
--------------
tags: hello world, first test
* Say "hello" to "gauge"
* Check if "blah" is returned from SaySomething
It fails on that last line because the Step isn't defined (duh). But, what I really want is something like - Say "hello" to "gauge" and expect "blah".
Yeah... Apparently I wasn't fully understanding the power of Gauge and what it is designed to do. The answer to my silly question is:
Use your favorite testing framework and use Asserts. Those Assert failures will show up on the Gauge reports (even though those Asserts aren't actually coming FROM Gauge - errors will fail the Scenario/Step too). Whether you are using C# or Java, just assume that Gauge is your test runner I guess, and you can do whatever you want for validation.

HP UFT API Test - Saving Response/Checkpoint values

Is there a way to capture and store (or write to a file) the values returned in the Response? (Checkpoint values)
Using HP UFT 11.52
Thanks,
Lynn
I figured it out. In UFT API under Standard Activities, there are File function modules including "Write to File". I added the module to the test, set the path and other properties, passed the variable to the file and it worked! Couldn't be easier.
I mentioned this on my other answer , you can also write it programatically if you have dynamic array response please refer below:
https://stackoverflow.com/a/28012383/3972994
After running a test, in the test folder, you can find a Snapshots/LastIteration directory.
In it you can find the return value for each step saved in a txt file.
Pay attention that if you data drive the step, only the last iteration will be saved to file.
However, in the Test's log (Test dir/Log/vtd_user.log) you can find all the iterations persisted
Thanks,
Yossi
You do not need to use the standard activities if you do this
var iResponse = this.Activity.responsebody;
System.IO.File.WriteLines(#"directorypath&FileName);
the above will write the response to the file and rewrite it for every run

Address Book is returning old values

I am having a problem with the AddressBook framework.
It all seems to be stemming from ABCopyRecordForUniqueId returning a record with old data.
Example:
I run up the program below in one terminal window - it shows the current data.
I make a change through the address book UI - my program continues to show old data.
I run up another instance of the same program in a new terminal window - it shows the updated data.
I have tried posting on the omnigroup site with no luck :( so any guidance is really appreciated
PS: If you would like to try the code, to get an address book ID you can export a contact as a vCard and open it with a text editor
int main (int argc, const char * argv[])
{
ABAddressBookRef addressBook = ABGetSharedAddressBook();
while(1)
{
ABRecordRef addressBookRecord = NULL;
addressBookRecord = ABCopyRecordForUniqueId(addressBook, CFSTR("4064D587-0378-4DCF-A6B9-D3702F01C94C:ABPerson"));
CFShow(addressBookRecord);
CFRelease(addressBookRecord);
sleep(1);
}
return 0;
}
I tried your example myself and am seeing the same problem. Out of curiosity, I tried asking for the shared address book inside the loop (in case there was some weirdness going on with the address book singleton) but this made no difference. I checked out the documentation (ABAddressBook C Reference) as well as the higher-level address book framework reference and guide. As far as I can tell, you're doing the right thing.
I'd file this as a bug against the framework.
thanks for the suggestion. I did file a report but it turns out this is expected
Annoying that it wasn't in the docs..
"Engineering has determined that this issue behaves as intended based on the following information:
The address book requires the run loop to be run in order to receive updates from other applications. Instead of sleep(1), use CFRunLoopRunInMode(kCFRunLoopDefaultMode, 1.0, false)."
Thanks,
M

Resources