1: $loop_count = 3
2: $cpu_threshold = 85
3: $memory_threshold = 90
4: $sleep_interval = 5
5: $hitcpu = 0
6: $hitmemory = 0
7: $target="firefox"
8: foreach($turn in 1..$loop_count)
9: {
10: $cpu = (gwmi -class Win32_Processor).LoadPercentage
11: $process = Get-Process | Where-Object {$_.ProcessName -eq $target}
12: $memory=[Math]::Round($process.privatememorysize/1mb, 2)
13: Add-content c:\users\amah11\Desktop\logs.txt "CPU utilization is Currently at $cpu%'"
14: Add-content c:\users\amah11\Desktop\logs.txt "Memory utilized by $target is $memory"
15: If($cpu -ge $cpu_threshold )
16: {
17: $hitcpu = $hitcpu+1
18: }
19: If($memory -ge $memory_threshold )
20: {
21: $hitmemory = $hitmemory + 1
22: }
23: start-sleep $sleep_interval
24: if($hit -eq 3)
25: {
26: Write-Host "CPU utilization above $cpu_threshold" -foregroundcolor red -backgroundcolor yellow
27: }
28: if($hitmemory -eq 3)
29: {
30: Write-Host "Memory utilization above $memory_threshold" -foregroundcolor red -backgroundcolor yellow
31: }
32: }
Monday, August 11, 2014
Powershell for Performance counters
Wednesday, August 6, 2014
Virtual Vuser Vs Real Users.
Load generator capacity calculation
- Run the single user test using controller. Keep a delay of few minutes in starting the script. Once script executions starts, observe the decrease in memory. Amount of memory decreased is our "First Vuser Memory"
- Modify the test to run for 5-10 Vuser. Keep a delay of few minutes in starting the script and for each vuser. Notice the decrease in memory when each new user ramp up. This decrease in memory is our "Each Additional Vuser memory"
- Now, for getting the Load generator capacity
- Find out the total RAM available on the load generator. This will be "Total RAM"
- Subtract 700-750 MB RAM for OS activities
- Find out what is the 75% of the remaining RAM
- Subtract "First Vuser Memory" from the remaining RAM in step 5
- Divide the figure by "Each Additional Vuser memory+1" to get number of vuser supported by LG
Wednesday, July 9, 2014
Heap management in JAVA
- - Heap memory
- - Non Heap memory
- - Other (JVM code, internal structure etc.)
Monday, July 7, 2014
Dynamic parameterization
char *current_host;
current_host = lr_get_host_name();
lr_output_message("The Actual Host is %s", current_host);
//Run the loop based on the number hosts you have in the parameter list
for(i=0;i<=20;i++)
{
lr_output_message("Current Host being verified is %s", lr_eval_string("{Host_Name}"));
if(strcmp(current_host,lr_eval_string("{Host_Name}"))==0)
{
lr_output_message("Setting the Username (%s), Password (%s) & Domain Name (%s) related to Host Name (%s)", lr_eval_string("{User_Name}"),lr_eval_string("{Password}"), lr_eval_string("{Domain}"), lr_eval_string("{Host_Name}"));
web_set_user("{User_Name}", "{Password}", "{Domain}");
break;
}
else
{
lr_output_message("Current Host evaluated is (%s) not matching with actual host", lr_eval_string("{Host_Name}"));
lr_advance_param("Host_Name");
}
Friday, July 4, 2014
Replay Engine in LoadRunner
Friday, August 5, 2011
Dealing with performance issue in Test Automation
Sometime while running automation test cases we faced performance issues with AUT. Page or object fails to load before timeout which leads to false failure. Though page is not getting loaded before timeout period is an issue but we don't want our test cases to fail just because page fails to load.
Following code will wait for page to load indefinitely. Though this may not be a good approach to wait indefinitely for page to load but it helps when we are experiencing serious problem with application performance
{
try
{
Selenium.WaitForPageLoad("5000");
break; //executed if page finished loading
}
catch (Exception)
{
//ignore the timeout exception
}
}