-
大小: 85KB文件類型: .gz金幣: 1下載: 0 次發布日期: 2021-06-07
- 語言: 其他
- 標簽: rpc.rstatd??4.0.1??loadrunner??linux??rpc??
資源簡介
使用教程
linux下安裝rpc.rstatd
1.rpc服務需rsh的支持,一般情況下rsh已安裝。rpm -qa rsh查看。
2.右鍵另存為http://heanet.dl.sourceforge.net/sourceforge/rstatd/rpc.rstatd-4.0.1.tar.gz下載rpc.rstatd-4.0.1.tar.gz。
3.執行以下命令解壓和安裝
tar zxvf rpc.rstatd-4.0.1.tar.gz
cd rpc.rstatd-4.0.1
./configure //配置
make //編譯
make install //安裝
4.啟動 rpc.rstatd
如果第一次執行rpc.rstatd報錯,按以下步驟可解決報錯
cd /etc/init.d
./portmap start
./nfs start
rpc.rstatd
5.檢驗,執行rpcinfo -p,看到以下信息表示安裝成功:
100001 5 udp 800 rstatd
100001 3 udp 800 rstatd
100001 2 udp 800 rstatd
100001 1 udp 800 rstatd
6.在LoadRunner中添加計數器
average load: 在過去的1分鐘的平均負載
cpu utilization: cpu的使用率
disk traffic: disk傳輸率
paging rate: 每秒從磁盤讀到物理內存,或者從物理內存寫到頁面文件的內存頁數
Swap-in rate: 每秒交換到內存的進程數
Swap-out rate: 每秒從內存交換出來的進程數 ......
代碼片段和文件信息
/*
?*?getdata.c?--?common?data?gathering?functions
?*
?*?Software?distributed?under?the?GPL?for?license?terms?see?the?file
?*?COPYING?in?this?directory
?*
?*?(c)?2005?Dr.?Andreas?Mueller?Beratung?und?Entwicklung
?*?$Id:?getdata.cv?1.3?2005/09/19?07:20:33?afm?Exp?$
?*/
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#include?
#define PATTERNS 6
char *patterns[PATTERNS]?=?{
“^((da|)s|h)d[a-z][a-z]*$“
“^scd[0-9]$“
“^(rd|ida|cciss)/c[0-9][0-9]*d[0-9]*$“
“^i2o/hd[a-z]*$“
“^amiradi/ar[0-9]*$“
“^carmel/[0-9][0-9]*$“
};
#define MAXINT 0x80000000
static?regex_t *rx[PATTERNS];
extern?int?ninterfaces;
extern?char?**interfaces;
/*?find?out?whether?a?device?with?a?given?name?is?a?disk?*/
int isdisk(const?char?*device)?{
int i;
for?(i?=?0;?i? if?(0?==?regexec(rx[i]?device?0?NULL?0))?{
return?1;
}
}
return?0;
}
/*?dummy?functions?*/
static?void get_disk(struct?statsusers?*s)?{
syslog(LOG_CRIT?“dummy?function?should?never?be?called!“);
exit(EXIT_FAILURE);
}
/*?cpu?is?identical?in?all?version?of?linux?*/
static?void get_cpu(struct?statsusers?*s)?{
FILE *stat;
char buf[1024];
unsigned?long?long cp[4];
unsigned?long?long l;
int i;
if?(NULL?==?(stat?=?fopen(“/proc/stat“?“r“)))?{
syslog(LOG_CRIT?“/proc/stat?not?found“);
exit(EXIT_FAILURE);
}
while?(fgets(buf?sizeof(buf)?stat))?{
if?(0?==?strncmp(buf?“cpu?“?4))?{
if?(4?!=?sscanf(buf?“cpu?%llu?%llu?%llu?%llu\n“
&cp[0]?&cp[1]&cp[2]?&cp[3]))?{
syslog(LOG_CRIT?“wrong?format?of?cpu?line“);
exit(EXIT_FAILURE);
}
/*?convert?the?cp?data?to?normal?longs?*/
for?(i?=?0;?i?4;?i++)?{
s->cp_time[i]?=?cp[i]?%?MAXINT;
}
}
if?(0?==?strncmp(buf?“intr?“?5))?{
if?(1?!=?sscanf(buf?“intr?%llu?“?&l))?{
syslog(LOG_CRIT?“wrong?format?of?intr?line“);
exit(EXIT_FAILURE);
}
s->v_intr?=?l?%?MAXINT;
}
if?(0?==?strncmp(buf?“ctxt?“?5))?{
if?(1?!=?sscanf(buf?“ctxt?%llu\n“?&l))?{
syslog(LOG_CRIT?“wrong?format?of?ctxt?line“);
exit(EXIT_FAILURE);
}
s->v_swtch?=?l?%?MAXINT;
}
}?/*?while?*/
fclose(stat);
}
static?void get_vm(struct?statsusers?*s)?{
FILE *stat;
char buf[1024];
if?(NULL?==?(stat?=?fopen(“/proc/stat“?“r“)))?{
syslog(LOG_CRIT?“/proc/stat?not?found“);
exit(EXIT_FAILURE);
}
while?(fgets(buf?sizeof(buf)?stat))?{
if?(0?==?strncmp(buf?“page?“?5))?{
if?(2?!=?sscanf(buf?“page?%u?%u?\n“
&s->v_pgpgin?&s->v_pgpgout))?{
syslog(LOG_CRIT?“wrong?format?of?page?line“);
exit(EXIT_FAILURE);
}
}
if?(0?==?strncmp(buf?“swap?“?5))?{
if?(2?!=?sscanf(buf?“swap?%u?%u“
&s->v_pswpin?&s->v_pswpout))?{
syslog(LOG_CRIT?“wrong?format?of?swap?line“);
exit(EXIT_FAILURE);
}
}
}?/*?while?*/
fclose(stat);
}
static?voi
評論
共有 條評論