Skip to content

Commit

Permalink
binding: return bytes instead of Mb
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Ye committed Jun 1, 2011
1 parent 41ba37e commit 8c37138
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions bsl/rusage.c
Expand Up @@ -4,12 +4,12 @@
#include <stdio.h>
#include <stdlib.h>

int usage() {
long usage() {
int who = RUSAGE_SELF;
struct rusage usage;
struct rusage *p = &usage;
getrusage(who, p);
return (p->ru_maxrss / (1024*1024));
return p->ru_maxrss;
}

#include <errno.h>
Expand All @@ -21,5 +21,5 @@ int usage() {

value get_memory_usage() {
CAMLparam0();
CAMLreturn(Val_int(usage()));
CAMLreturn(Val_long(usage()));
}
4 changes: 2 additions & 2 deletions src/main.opa
Expand Up @@ -78,8 +78,8 @@ launch(author:string) =
len = List.length(history_list)
history = List.drop(len-20, history_list)
// FIXME: optimize this...
do List.iter(user_update(get_memory_usage()), history)
Network.add_callback(user_update(get_memory_usage()), room)
do List.iter(user_update(get_memory_usage()/(1024*1024)), history)
Network.add_callback(user_update(get_memory_usage()/(1024*1024)), room)
logout() =
do broadcast({system}, "leave", "{author} has left the room")
Client.goto("/")
Expand Down

0 comments on commit 8c37138

Please sign in to comment.