![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to Find JRE installed in linux machine..? | XivaX | Shell Programming and Scripting | 3 | 01-31-2008 06:18 PM |
| find usable keyboard and mouse for UNIX spac machine. Help | duke0001 | UNIX for Dummies Questions & Answers | 2 | 09-05-2006 02:12 PM |
| How to find which machine ... | premnathk | UNIX for Dummies Questions & Answers | 3 | 07-17-2006 05:40 AM |
| ping Port number of HPUX machine | Teh Tiack Ein | HP-UX | 1 | 12-04-2005 12:38 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
trying to find number of caches on a machine
I am trying to find the number of caches on a machine programatically.
#include <stdio.h> #include <malloc.h> int main(void) { int *ptr,*ptr1,i,j; j=0; i=1; printf("Changing allocation with brk()\n"); while(1) { for(j=0;j<i;j++) { ptr = (int *) malloc(i); ptr[j] = j; printf("VALUE %d is:: %lu\n",j,ptr[j]); brk(ptr+i); ptr1=(ptr+j); printf(" VALUE of trace end is::%lu\n",ptr1); i++; } } return 0; } I was thinking of embedding time in such a way that I could track access to a particular growing memory size. The moment the access time varied, the cache level was changed. Am I thinking along the right lines, please guide me. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Interesting idea but your code seems to be too complicated for me.
Try to alloc memory once (e.g. 10MB) and perform timing of 'mangling' areas of growing size: 256kB, 512kB, and so on. Mangling can be as simple as mem[i]++ Regards |
|||
| Google The UNIX and Linux Forums |