-
Memory Leak diagnoses
2009-06-23 15:54:46
There are a number of counters in the memory category that you can use to spot poor performance that may be caused by insufficient RAM. Here are some of those counters:
PAGES/SEC – this value counts the number of times per second that the computer must access virtual memory rather than physical memory. A value above 20 is considered to be problematic, but it may indicate a problem with the way that your virtual memory is configured rather than a problem with the physical memory.
Committed Bytes and Available Bytes – The Committed Bytes counter traces the amount of virtual memory that’s in use. The Available Bytes counter monitors how much memory is actually available. As you might expect, as the Available Bytes counter decreases, paging increases, thus slowing down your machine. If you determine that the Available Bytes are often in short supply, you can correct the problem by adding memory. However, before you do, try watching both counters together as you open and close programs. If the committed bytes don’t decrease and available bytes don’t increase as you close programs, the system may have a memory leak which is caused by a software problem rather than insufficient RAM.
Pool Nonpaged Bytes and Pool Nonpaged Allocs – Another way to test for memory leaks is to watch these two counters. The Pool Nonpaged Bytes counter counts pages of memory that can’t be moved to virtual memory, but must stay in the physical RAM. Normally, if this value is too high, you’ll have to add more memory. However, you can watch the Pool Nonpaged Allocs counter to see just how many calls are being made to that portion of the memory. If the number of calls don’t seem to correspond with the number of memory pages, you may have a memory leak rather than insufficient memory.
Cache Bytes – This counter monitors the amount of memory being used for the file system cache. Anything over 4 MB is considered to be to much. The solution is to add more memory.
-
LR 中lr_set_user的使用
2009-05-22 10:38:49
在使用LR的时候,回放服务器报401 Access Denied错误,
当WEB服务器不允许匿名访问,而我们又没有提供正确的用户名/密码时,服务器就会给出这个返回代码。在IIS中,设置IIS的安全属性为不允许匿名访问,此时直接访问的话就会得到以下返回结果:HTTP/1.1 401 Access Denied
Server: Microsoft-IIS/5.1
Date: Mon, 06 Mar 2006 09:15:55 GMT
WWW-Authenticate: Negotiate
WWW-Authenticate: NTLM
Connection: close
Content-Length: 3964
Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html dir=ltr>
……
此时跳出对话框,让我们输入用户名和密码,当我们在输入了用户名和密码以后,服务器与客户端会再进行两次对话。首先客户端向服务器索取一个公钥,服务器端会返回一个公钥,二者都用BASE64编码,相应的消息如下(编码部分已经做了处理):
GET / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Host: 192.168.0.55:8080
Connection: Keep-Alive
Authorization: Negotiate ABCDEFG……
HTTP/1.1 401 Access Denied
Server: Microsoft-IIS/5.1
Date: Mon, 06 Mar 2006 09:20:53 GMT
WWW-Authenticate: Negotiate HIJKLMN……
Content-Length: 3715
Content-Type: text/html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html dir=ltr>
……
客户端拿到公钥之后使用公钥对用户名和密码进行加密码,然后把加密以后的结果重新发给服务器:
GET / HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Language: zh-cn
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Host: 192.168.0.55:8080
Connection: Keep-Alive
Authorization: Negotiate OPQRST……
这样,如果验证通过,服务器端就会把请求的内容发送过来了,也就是说禁止匿名访问的网站会经过三次请求才可以看到页面。但因为客户端浏览器已经缓存了公钥,用同一个浏览器窗口再次请求这个网站上的其它页面时就可以直接发送验证信息,从而一次交互就可以完成了。脚本代码如下:
#include "web_api.h"
Action()
{
int i=0;
int iLink_Counts=0;
int iRnd_link=0;
char buffer[20]="";
char url[20]="";web_set_user("192.168.1.111\\administrator", "123456", "192.168.1.111:80");
web_reg_save_param("Save_Links",
"LB=<a href=\"",
"RB=\"",
"ORD=All",
LAST);web_url("192.168.1.84",
"URL=http://192.168.1.111/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t3.inf",
"Mode=HTML",
LAST);
//获得参数文件数组大小
lr_output_message("数组大小:%d",atoi(lr_eval_string("{Save_Links_count}")));
iLink_Counts=atoi(lr_eval_string("{Save_Links_count}"));for(i=1;i<=iLink_Counts;i=i+1)
{
sprintf(buffer,"{Save_Links_%d}",i);
lr_output_message("%s",lr_eval_string(buffer)) ;
}srand(time(NULL));
iRnd_link=rand() % iLink_Counts +1;
sprintf(buffer,"{Save_Links_%d}",iRnd_link);
// url="URL="+ lr_eval_string(buffer");
strcpy(url,"URL=");
strcat(url,lr_eval_string(buffer));
web_url(lr_eval_string(buffer),
url,
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t3.inf",
"Mode=HTML",
LAST);return 0;
} -
LR 从XML文件读取数据(转载)
2009-05-21 15:47:19
1.配置文件"c:\\hfeitest.xml"<users>
<user>
<name>abc0015admin0</name>
<productId>B001261</productId>
<unitId>A0000Q1</unitId>
<customerId>B00141</customerId>
<supplierId>B001262</supplierId>
<storeId>B001162</storeId>
<accountId>B001162</accountId>
<employeeId>A00010</employeeId>
<departmentId>A00010</departmentId>
<paymentMethodId></paymentMethodId>
</user>
</users>2.代码#include "as_web.h"
char *productId;//产品
char *unitId;//计量单位
char *customerId;//客户
char *supplierId;//供应商
char *storeId;//仓库
char *accountId;//帐号
char *employeeId;//职员
char *departmentId;//部门
char *paymentMethodId;//付款方式
//作者:黄飞//日期:20080216
//功能:根据传入用户参数,初始化产品等变量配置,达到动态获取参数的目的
initData(char userId)
{
char *filename = "c:\\hfeitest.xml";
char *content;
char buffer[1000];
long file_stream;
if ((file_stream = fopen(filename, "r" )) == NULL) {
lr_output_message("Unable to create %s", filename);
return -1;
}
lr_save_string(lr_eval_string(""),"XML_Input_Param");
while(!feof(file_stream))
{
fread(buffer, sizeof(char), 999, file_stream); buffer[len] = '\0';
lr_save_string(buffer,"content");
lr_save_string(lr_eval_string("{XML_Input_Param}{content}"),"XML_Input_Param"); }
fclose(file_stream); lr_output_message(lr_eval_string("{XML_Input_Param}"));
lr_output_message(lr_eval_string("{userId}")); lr_xml_get_values("XML={XML_Input_Param}",
"ValueParam=OutputParam",
"Query=/users/user[name=\"{userId}\"]/productId",
LAST); lr_save_string(lr_eval_string("{OutputParam}"), "productId");
lr_output_message(lr_eval_string("UserNamaID={userId} and Query productId = {productId}"));
}
vuser_init()
{
char userId;
lr_save_string(lr_eval_string("{username}"), "userId");
initData(userId); ...} -
LoadRunner 中关于自定义变量的使用
2009-05-21 15:31:25
用lr_save_string或sprintf()都可以引用:
Action()
{
char *word="man";
char para[50];
lr_save_string (word ,"para");
//sprintf(para,"%s",word);
web_url("www.baidu.com",
"URL=http://www.baidu.com/",
"Resource=0",
"RecContentType=text/html",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
LAST);
web_submit_form("s",
"Snapshot=t2.inf",
ITEMDATA,
"Name=wd", "Value={para}", ENDITEM,
EXTRARES,
"Url=http://s.baidu.com/w.gif?path=http://www.baidu.com/s?wd=123&t=1222584836609", "Referer=http://www.baidu.com/s?wd=123", ENDITEM,
LAST);
lr_output_message ("search============> :%s",lr_eval_string ("{para}"));
return 0;
}
我的栏目
标题搜索
我的存档
数据统计
- 访问量: 20379
- 日志数: 14
- 文件数: 1
- 建立时间: 2007-09-19
- 更新时间: 2014-04-11