|
|
|
Re: Where can we download the "vzstat" source code? [message #2771 is a reply to message #2770] |
Thu, 20 April 2006 06:03 |
dev
Messages: 1693 Registered: September 2005 Location: Moscow
|
Senior Member |
|
|
You can use /proc/vz/vestat file:
[root@tst ~]# cat /proc/vz/vestat
Version: 2.2
VEID user nice system uptime idle strv uptime used maxlat totlat numsched
100 0 0 5063 40598698 70123626936598 0 35069066535737 8612439976 2314 737714316 53144
in this file for each VPS you have:
1. "user nice system uptime" in jiffies. i.e. divide by jiffies_per_second to get seconds (see below).
2. "idle strv uptime used" in cycles. much more accurate. seconds = used / cycles_per_jiffy / jiffies_per_seconds.
3. values of cycles_per_jiffy and jiffies_per_seconds can be read from /proc/vz/stats
BTW, while looking into this I found a small misprint in /proc/vz/vestat output code, so thank you very much
--- ./kernel/vecalls.c.usertm 2006-04-07 19:04:46.000000000 +0400
+++ ./kernel/vecalls.c 2006-04-20 10:05:24.000000000 +0400
@@ -2875,7 +2875,7 @@ static int vestat_seq_show(struct seq_fi
idle_time = strv_time = used = 0;
for (cpu = 0; cpu < NR_CPUS; cpu++) {
- user_ve += VE_CPU_STATS(ve, cpu)->nice;
+ user_ve += VE_CPU_STATS(ve, cpu)->user;
nice_ve += VE_CPU_STATS(ve, cpu)->nice;
system_ve += VE_CPU_STATS(ve, cpu)->system;
used += VE_CPU_STATS(ve, cpu)->used_time;
|
|
|
|
|
|
Re: Where can we download the "vzstat" source code? [message #22448 is a reply to message #22433] |
Mon, 29 October 2007 08:31 |
dev
Messages: 1693 Registered: September 2005 Location: Moscow
|
Senior Member |
|
|
it's quite easy:
[root@dhcp0-95 ~]# cat /proc/vz/vestat
Version: 2.2
VEID user nice system uptime idle strv uptime used maxlat totlat numsched
100 1634 0 1712 343011435 1277332114762816 0 638679179771038 16971458021 4921 5633592426 145722
1 157635 0 29103 488618806 1818929923633445 0 909796661898187 512196984005 4858 50362877628 2524559
101 759 0 1844 488627361 1819537209544684 0 909812591751777 33663331702 4529 10257230389 713559
103 765 0 1468 488628230 1819533866071061 0 909814208459884 28408677122 5117 11686660006 712016
105 4522 0 5088 488628270 1819572969105220 0 909814283772065 22621645151 4949 7557632985 125350
- column 1 "VEID": VE id
- column 2 "user", 3 "nice", 4 "system", 5 "uptime" - corresponding std user/nice/system/uptime values in jiffies to standalone linux /proc/stat. Note, there is no "idle" time here, since it can't be calculated this way.
the next group comes in cycles units:
- column 6 "idle" - idle time, 7 "strv" - not used, 8 "uptime" - uptime in cycles, 9 "used" - used time by VE across all CPUs in cycles
the next group is scheduling latency statistics in cycles:
- column 10 "maxlat" - max latency in cycles meaning how long VE process has to wait before it actually got CPU time.
- column 11/12 "totlat/numsched", i.e. divide 11 on 12 to get average scheduling latency.
you can also read:
[root@dhcp0-95 ~]# cat /proc/vz/stats
Version: 2.6
cycles_per_jiffy: 1860831
jiffies_per_second: 1000
to understand how many cycles and jiffies are per second.
|
|
|
|
|
Re: Where can we download the "vzstat" source code? [message #22767 is a reply to message #22766] |
Sat, 03 November 2007 09:45 |
rickb
Messages: 368 Registered: October 2006
|
Senior Member |
|
|
Hi, I thought these fields were only avaialble in the virtuozzo kernel.
virtuozzo 3.x 2.6.9
Quote: |
[root@yttrium ~]# cat /proc/vz/vestat
Version: 2.2
VEID user nice system uptime idle strv uptime used maxlat totlat numsched
1030 34518869 562190 10999333 783842709 9045444692949996 0 2402735226105746 141451539991400 31786364 249070126464914 69045720
2086 29900400 0 4506271 1636856393 19450221162219816 0 5017502202734454 108719002917852 2942466202 345587087247930 57824594
1024 21191653 0 23079329 2060298740 24614175256611440 0 6315492003670710 141218633354376 55571736 187231807734994 75413693
1033 22317199 0 72997502 2744987204 12939562299845728 0 8414286920957352 1083430833802996 162172532 22732088731566506 3584853667
9889220 52074253 4596608 18967106 3807321208 34535853929424632 0 11670689390962514 289382121038592 5121172724 19637723631512872 191177819
[root@yttrium ~]# uname -a
Linux yttrium 2.6.9-023stab033.7-enterprise #1 SMP Wed Nov 15 14:58:00 MSK 2006 i686 i686 i386 GNU/Linux
[root@yttrium ~]#
|
openvz 2.6.18 el5 kernel:
Quote: |
[root@beast ~]# more /proc/vz/vestat
Version: 2.2
VEID user nice system uptime idle strv uptime used maxlat totlat numsched
9889998 133305 119 32588 18161899 337438033162426 0 42371308510342 397498699339 0 0 0
9890597 3578 59165 216691 20955483 385816188773967 0 48888681988797 675360951251 0 0 0
9890697 1082186 151 167382 21137597 384817445703089 0 49313548979135 2953753939612 0 0 0
9891687 98727 395 100033 59602854 1088224694685604 0 139052138699873 525936556194 0 0 0
9890885 879421 144 32052757 70982874 577295962439301 0 165601472128687 80575127114055 0 0 0
9890873 15481 338 10649 76233353 1390464816241648 0 177850721787158 74312085540 0 0 0
9890825 325128 330 192029 91927040 1699110331139417 0 214463745852951 1260942674159 0 0 0
9891890 67485 625 42338 121264030 2162101569813360 0 282906292312196 264202327921 0 0 0
9890978 278071 538 298084 146878626 2668734525714551 0 342666792897541 1481079142459 0 0 0
9890715 311897 635 187855 147589429 2735871461013208 0 344325080204707 1291547097603 0 0 0
|
-------------
Common Terms I post with: http://wiki.openvz.org/Category:Definitions
UBC. Learn it, love it, live it: http://wiki.openvz.org/Proc/user_beancounters
[Updated on: Sat, 03 November 2007 09:45] Report message to a moderator
|
|
|
|
|
|
Re: Where can we download the "vzstat" source code? [message #22953 is a reply to message #22952] |
Thu, 08 November 2007 08:59 |
KoolK
Messages: 8 Registered: September 2007
|
Junior Member |
|
|
Hi,
by infinite process I mean following file
#include<stdio.h>
int main()
{
for(;;);
return 0;
}
so I run 40 processes of such kind with some having nice value 19, after that system says memory insufficient to spawn new process.
Still in this case /proc/vz/vestat shows 0 for maxlat, totallat n numsched. even in rickB's example in previous post, the file has 0 values.
this is my top command output in VE 1001 after running 37 instances of infinite process
top - 11:58:15 up 2:22, 0 users, load average: 33.96, 26.71, 13.17
Tasks: 51 total, 36 running, 15 sleeping, 0 stopped, 0 zombie
Cpu(s): 99.3% us, 0.3% sy, 0.3% ni, 0.0% id, 0.0% wa, 0.0% hi, 0.0% si
Mem: 505200k total, 495700k used, 9500k free, 39208k buffers
Swap: 1084348k total, 0k used, 1084348k free, 187308k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
22084 root 25 0 1384 232 184 R 3.7 0.0 0:12.62 infinite
22036 root 25 0 1384 232 184 R 3.3 0.0 0:13.89 infinite
22037 root 25 0 1384 232 184 R 3.3 0.0 0:13.19 infinite
22038 root 25 0 1384 232 184 R 3.3 0.0 0:13.14 infinite
22039 root 25 0 1388 236 184 R 3.3 0.0 0:13.12 infinite
22040 root 25 0 1384 232 184 R 3.3 0.0 0:13.10 infinite
22043 root 25 0 1384 232 184 R 3.3 0.0 0:13.09 infinite
22044 root 25 0 1384 232 184 R 3.3 0.0 0:12.89 infinite
22046 root 25 0 1384 232 184 R 3.3 0.0 0:12.92 infinite
22049 root 25 0 1388 236 184 R 3.3 0.0 0:12.90 infinite
22050 root 25 0 1388 236 184 R 3.3 0.0 0:12.89 infinite
22051 root 25 0 1384 232 184 R 3.3 0.0 0:13.59 infinite
22052 root 25 0 1388 236 184 R 3.3 0.0 0:12.89 infinite
22065 root 25 0 1384 232 184 R 3.3 0.0 0:11.80 infinite
22066 root 25 0 1384 232 184 R 3.3 0.0 0:12.59 infinite
22067 root 25 0 1384 232 184 R 3.3 0.0 0:11.89 infinite
22068 root 25 0 1384 232 184 R 3.3 0.0 0:11.84 infinite
But still output of /proc/vz/vestat is -
[root@khyati-laptop home]# cat /proc/vz/vestat
Version: 2.2
VEID user nice system uptime idle strv uptime used maxlat totlat numsched
1001 990058 931 1922 8628377 2320326584544 0 3988923534912 1559444504772 0 0 0
|
|
|
Re: Where can we download the "vzstat" source code? [message #32962 is a reply to message #2687] |
Thu, 11 September 2008 01:55 |
gurtaj
Messages: 12 Registered: September 2008 Location: London, Ontario, Canada
|
Junior Member |
|
|
Hello. I've found this message while looking for information about how to calculate the CPU usage percentage of a container (yeah... one more trying to do the same).
The fact is that I'm having some troubles, so I'd appreciate any help.
I started a container (# 109) and captured the following values:
VEID user nice system uptime idle strv uptime used maxlat totlat numsched
109 9 0 30 225316 4494871181910 0 4494982391820 793267650 0 0 0
So, let's start with the calculations:
- if jiffies_per_second = 1000 (as indicated by dev), the first uptime value equals 225.316 seconds.
Anyway, I was trying to match both uptime values, the one in jiffies and the one in cycles.
As far as I understand, the second value should be divided by cycles_per_jiffy:
CPU: Intel Core Duo T2450 @ 2.00 GHz
CPU MHz: 1995.115
cycles_per_jiffy = 1995115 / 1000 = 1995.115
(which seems pretty small compared with the one given by dev as example of his processor, which I guess it was a 1.86 GHz)
Now, if I devide the second uptime value by the previously obtained cycles_per_jiffy:
seconds = uptime / cycles_per_jiffy = 4494982391820 / 1995.115 = 22527270349023.399653654
... OK, the value starts similar, but they are quite different.
So... what I'm understanding wrong?
Thanks for the help!
|
|
|
|
|
|
|