Add vm statistics to browser

cvs
Chris Double 2004-08-01 22:29:51 +00:00
parent be47ff8672
commit 13bcbfd465
1 changed files with 20 additions and 1 deletions

View File

@ -104,6 +104,24 @@ USE: errors
] ifte ] ifte
] bind drop ; ] bind drop ;
: get-vm-runtime ( -- java.lang.Runtime )
f "java.lang.Runtime" "getRuntime" jinvoke-static ;
: get-free-memory ( java.lang.Runtime -- int )
f "java.lang.Runtime" "freeMemory" jinvoke ;
: get-total-memory ( java.lang.Runtime -- int )
f "java.lang.Runtime" "totalMemory" jinvoke ;
: write-vm-statistics ( -- )
#! Display statistics about the JVM in use.
<table> [
<tr> [ <td> [ "Free Memory" write ] </td>
<td> [ get-vm-runtime get-free-memory write ] </td> ] </tr>
<tr> [ <td> [ "Total Memory" write ] </td>
<td> [ get-vm-runtime get-total-memory write ] </td> ] </tr>
] </table> ;
: write-browser-body ( -- ) : write-browser-body ( -- )
#! Write out the HTML for the body of the main browser page. #! Write out the HTML for the body of the main browser page.
[ [
@ -112,7 +130,8 @@ USE: errors
[ [
"current-vocab" get "current-word" get write-word-source "current-vocab" get "current-word" get write-word-source
] ]
] horizontal-layout ; ] horizontal-layout
write-vm-statistics ;
: flatten ( tree - list ) : flatten ( tree - list )
#! Flatten a tree into a list. #! Flatten a tree into a list.