Skip to content

Commit

Permalink
LDEV-4833 build: log memory usage with a GC
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Apr 18, 2024
1 parent 5a8e7ea commit d76a1d0
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions test/run-tests.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ try {
var rpt = replace(ucFirst(qry.type), '_', ' ')
& " " & qry.name & ": " & numberFormat(perc) & "%, " & numberFormat( qry.used / 1024 / 1024 ) & " Mb";
if ( structKeyExists( arguments.prev, qry.name ) ) {
rpt &= ", (+ " & numberFormat( (qry.used - arguments.prev[ qry.name ] ) / 1024 / 1024 ) & " Mb)";
var change = numberFormat( (qry.used - arguments.prev[ qry.name ] ) / 1024 / 1024 );
if ( change gt 0 ) {
rpt &= ", (+ " & change & "Mb )";
} else if ( change lt 0 ) {
rpt &= ", ( " & change & "Mb )";
}
}
arrayAppend( report, rpt );
used[ qry.name ] = qry.used;
Expand Down Expand Up @@ -373,8 +378,24 @@ try {
arrayAppend( results, "Active Threads: #NumberFormat( threadCount )#");
arrayAppend( results, "CFTHREADS: #NumberFormat( ThreadData().len() )#");
postTestMeM = reportMem( "", _reportMemStat.usage );
arrayAppend( results, postTestMeM.report, true );
arrayAppend( results, "Force GC");
createObject( "java", "java.lang.System" ).gc();
postTestGC = reportMem( "", postTestMeM.usage )
arrayAppend( results, "");
arrayAppend( results, postTestGC.report, true );
structClear( CFTHREAD );
arrayAppend( results, "");
arrayAppend( results, reportMem( "", _reportMemStat.usage ).report, true );
arrayAppend( results, "Force GC after structClear(cfthread)");
createObject( "java", "java.lang.System" ).gc();
arrayAppend( results, "CFTHREADS: #NumberFormat( ThreadData().len() )#");
arrayAppend( results, "Active Threads: #NumberFormat( threadCount )#");
arrayAppend( results, "");
arrayAppend( results, reportMem( "", postTestGC.usage ).report, true );
arrayAppend( results, "");
arrayAppend( results, "=============================================================" & NL);
arrayAppend( results, "-> Bundles/Suites/Specs: #result.getTotalBundles()#/#result.getTotalSuites()#/#result.getTotalSpecs()#");
Expand Down

0 comments on commit d76a1d0

Please sign in to comment.