Re: Patch wanted: VmRSS, VmSize and VmStk in /proc/pid/status

2014-05-19 Thread Scot Hetzel
On Sun, May 18, 2014 at 3:45 PM, Thierry Thomas thie...@freebsd.org wrote:
 Le mer 14 mai 14 à 10:03:34 +0200, Scot Hetzel swhet...@gmail.com
  écrivait :

   It's why I'm looking for help here: does somebody knows how the
   corresponding values of these Vm... can be found in FreeBSD?
 
  You could try reading the source for linprocfs to see how it gets those 
  values:
 
  https://svnweb.freebsd.org/base/head/sys/compat/linprocfs/linprocfs.c?revision=263620view=markup#l748
 
  Good idea, I'll check it!

 You may also want to check usr.bin/procstat and lib/libprocstat.

 Here I am - almost! I have written a patch giving all these values -
 excepted VmPeak: I cannot find its definition neither in linprocfs nor
 elsewhere. This value is also missing from our
 /compat/linux/proc/%pid%/status.

 Setting it to -1 seems working, but if someone knows how to get it, it
 would be better.

Have a look at the Linux Kernel:

https://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git/tree/fs/proc

Look at array.c and task_mmu.c to see how VmPeak is calculated.

-- 
DISCLAIMER:

No electrons were maimed while sending this message. Only slightly bruised.
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: Patch wanted: VmRSS, VmSize and VmStk in /proc/pid/status

2014-05-18 Thread Thierry Thomas
Le mer 14 mai 14 à 10:03:34 +0200, Scot Hetzel swhet...@gmail.com
 écrivait :

   It's why I'm looking for help here: does somebody knows how the
   corresponding values of these Vm... can be found in FreeBSD?
 
  You could try reading the source for linprocfs to see how it gets those 
  values:
 
  https://svnweb.freebsd.org/base/head/sys/compat/linprocfs/linprocfs.c?revision=263620view=markup#l748
 
  Good idea, I'll check it!
 
 You may also want to check usr.bin/procstat and lib/libprocstat.

Here I am - almost! I have written a patch giving all these values -
excepted VmPeak: I cannot find its definition neither in linprocfs nor
elsewhere. This value is also missing from our
/compat/linux/proc/%pid%/status.

Setting it to -1 seems working, but if someone knows how to get it, it
would be better.

Thanks!
-- 
Th. Thomas.
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: Patch wanted: VmRSS, VmSize and VmStk in /proc/pid/status

2014-05-14 Thread Scot Hetzel
On Tue, May 13, 2014 at 3:01 PM, Thierry Thomas thie...@freebsd.org wrote:
 Le mar 13 mai 14 à 10:28:24 +0200, Scot Hetzel swhet...@gmail.com
  écrivait :

  It's why I'm looking for help here: does somebody knows how the
  corresponding values of these Vm... can be found in FreeBSD?

 You could try reading the source for linprocfs to see how it gets those 
 values:

 https://svnweb.freebsd.org/base/head/sys/compat/linprocfs/linprocfs.c?revision=263620view=markup#l748

 Good idea, I'll check it!

You may also want to check usr.bin/procstat and lib/libprocstat.


-- 
DISCLAIMER:

No electrons were maimed while sending this message. Only slightly bruised.
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: Patch wanted: VmRSS, VmSize and VmStk in /proc/pid/status

2014-05-13 Thread Scot Hetzel
On Mon, May 12, 2014 at 4:35 PM, Thierry Thomas thie...@freebsd.org wrote:
 Hello,

 In the new versions of french/aster, there is this piece of Linux code:

 ---
 static char filename[80];
 static char sbuf[1024];
 char* S;
 int fd, num_read;
 long lmem;
 pid_t numpro;

 pid_t getpid(void);

 numpro = getpid();

 sprintf(filename, /proc/%ld/status, (long)numpro);
 fd = open(filename, O_RDONLY, 0);
 if (fd==-1) return -1;
 num_read=read(fd,sbuf,(sizeof sbuf)-1);
 close(fd);

 S=strstr(sbuf,VmData:)+8;
 val[0] = (INTEGER)atoi(S);

 S=strstr(sbuf,VmSize:)+8;
 val[1] = (INTEGER)atoi(S);

 if ( strstr(sbuf,VmPeak:) != NULL ) {
 S=strstr(sbuf,VmPeak:)+8;
 val[2] = atoi(S);
 } else {
 val[2] = -1 ;
 }

 S=strstr(sbuf,VmRSS:)+7;
 val[3] = (INTEGER)atoi(S);

 S=strstr(sbuf,VmStk:)+7;
 lmem = atoi(S);
 return lmem ;
 ---

 Of course, it does'nt work on FreeBSD, because our status has a
 different structure.

 As a quick  dirty work-around, I patched it to replace /proc by
 /compat/linux/proc and it works. Unfortunately, this is not a good
 solution, because this port is no more packageable (this piece of code
 is run at the end of the build).

 It's why I'm looking for help here: does somebody knows how the
 corresponding values of these Vm... can be found in FreeBSD?


You could try reading the source for linprocfs to see how it gets those values:

https://svnweb.freebsd.org/base/head/sys/compat/linprocfs/linprocfs.c?revision=263620view=markup#l748


-- 
DISCLAIMER:

No electrons were maimed while sending this message. Only slightly bruised.
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Re: Patch wanted: VmRSS, VmSize and VmStk in /proc/pid/status

2014-05-13 Thread Thierry Thomas
Le mar 13 mai 14 à 10:28:24 +0200, Scot Hetzel swhet...@gmail.com
 écrivait :

  It's why I'm looking for help here: does somebody knows how the
  corresponding values of these Vm... can be found in FreeBSD?
 
 You could try reading the source for linprocfs to see how it gets those 
 values:
 
 https://svnweb.freebsd.org/base/head/sys/compat/linprocfs/linprocfs.c?revision=263620view=markup#l748

Good idea, I'll check it!
-- 
Th. Thomas.
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org


Patch wanted: VmRSS, VmSize and VmStk in /proc/pid/status

2014-05-12 Thread Thierry Thomas
Hello,

In the new versions of french/aster, there is this piece of Linux code:

---
static char filename[80];
static char sbuf[1024];
char* S;
int fd, num_read;
long lmem;
pid_t numpro;

pid_t getpid(void);

numpro = getpid();

sprintf(filename, /proc/%ld/status, (long)numpro);
fd = open(filename, O_RDONLY, 0);
if (fd==-1) return -1;
num_read=read(fd,sbuf,(sizeof sbuf)-1);
close(fd);

S=strstr(sbuf,VmData:)+8;
val[0] = (INTEGER)atoi(S);

S=strstr(sbuf,VmSize:)+8;
val[1] = (INTEGER)atoi(S);

if ( strstr(sbuf,VmPeak:) != NULL ) {
S=strstr(sbuf,VmPeak:)+8;
val[2] = atoi(S);
} else {
val[2] = -1 ;
}

S=strstr(sbuf,VmRSS:)+7;
val[3] = (INTEGER)atoi(S);

S=strstr(sbuf,VmStk:)+7;
lmem = atoi(S);
return lmem ;
---

Of course, it does'nt work on FreeBSD, because our status has a
different structure.

As a quick  dirty work-around, I patched it to replace /proc by
/compat/linux/proc and it works. Unfortunately, this is not a good
solution, because this port is no more packageable (this piece of code
is run at the end of the build).

It's why I'm looking for help here: does somebody knows how the
corresponding values of these Vm... can be found in FreeBSD?

Thanks,
-- 
Th. Thomas.
___
freebsd-ports@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to freebsd-ports-unsubscr...@freebsd.org