18 double StMem::fUsed=0;
24 return double(info.uordblks + info.usmblks)/1000000;
36 ps = (
char*)malloc(20);
37 sprintf(ps,
"ps -l -p %d",pid);
39 FILE *pipe = ::popen(ps,
"r");
44 while( !feof( pipe ) ) {
46 if(!fgets( psBuf+1, 128, pipe))
continue;
50 for (c=psBuf; c[0]; c++) {
51 if (c[0]==
' ' && c[1]!=
' ') ifild++;
52 if (ifild == 10)
break;
54 res = (double)atoi(c+1);
58 res *=::getpagesize()/(1024.*1024.);
63 void StMem::Print(
const char *tit)
66 double exec = ESize();
68 if (tit) printf(
"\nStMem::%s",tit);
69 printf(
"\t total =%10.6f heap =%10.6f (%+10.6f)\n",exec, used,used-fUsed);