[Info-vax] How to obtain percentage of a given CPU consumed by a process

Johnny Billquist bqt at softjar.se
Tue Jun 7 07:18:48 EDT 2016


On 2016-06-06 17:20, John Reagan wrote:
> On Monday, June 6, 2016 at 8:51:05 AM UTC-4, Johnny Billquist wrote:
>> On 2016-06-04 09:40,  wrote:
>>> On Wednesday, May 25, 2016 at 1:50:16 PM UTC+12, IanD wrote:
>>>> I'm looking for a way to find the CPU consumption for a given process on a given CPU...
>>>
>>> I remember once I brought a VAX virtually to its knees, while recording almost 0% CPU usage. Ask me how...
>>
>> Thrash the virtual memory system? That's easy...
>> Write a program that just hits one byte on each page, and enough pages
>> to not be in the working set. The machine will be very busy just paging...
>>
> The Modified Page List will make those page faults really cheap.  Removing a page from a working set rarely causes any immediate page file activity.  You'll just be shuffling PTEs between your working set and the MPL.  Only when you get into really tight memory situations will you need to physically write out the pages.  We've run systems with large physical memory without any page files.
>
> On this system (which does have an installed page file):
>
> $ show memory
>               System Memory Resources on  6-JUN-2016 11:14:12.65
>
> Physical Memory Usage (pages):     Total        Free      In Use    Modified
>   Main Memory (127.99GB)        16777168    13441949     3334466         753
>
> I doubt we've done any writes to it since boot.
>
> The better way is to keep allocating memory and writing to it.  If your system manager has given you sufficient page file quota, you can log in multiple times and push hard on that MPL.

Well, ok, yes, you need to grab enough memory that it can't be kept in 
the modified page list. The point is to force a page fault and paging 
for each memory access. Which also means yes, you should be writing, and 
not reading.

Essentially:

char *mem;

mem = malloc(really_big_chunk);

while (1) {
   for (i=0; i<really_big_chunk; i += pagesize) ++mem[i];
}

That will create a lot of fun.
For even more fun, run a few of those in parallel.

   Johnny




More information about the Info-vax mailing list