projects
/
platform
/
upstream
/
gstreamer.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Merged from INCSCHED on 200505251!!!
[platform/upstream/gstreamer.git]
/
tests
/
old
/
testsuite
/
refcounting
/
mem.c
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include <fcntl.h>
4
#include <unistd.h>
5
6
int vmsize() {
7
int pid,fd,size,i,mem;
8
char filename[17], buf[256], *ptr, *end;
9
10
pid = getpid();
11
snprintf(filename,17,"/proc/%d/stat",pid);
12
fd = open(filename,O_RDONLY);
13
size = read(fd,buf,240);
14
ptr = buf;
15
for (i=0;i<22;i++)
16
ptr = (char *)strchr(ptr,' ') + 1;
17
end = (char *)strchr(ptr,' ');
18
*end = 0;
19
sscanf(ptr,"%d",&mem);
20
close(fd);
21
return mem;
22
}