private static synchronized Datum generateCurrentSample ( ) { // Code used to fake system statistics by tests if ( testStatsProducer != null ) { return testStatsProducer . getCurrentStatsData ( ) ; } // get this info once if ( ! initialized ) initialize ( ) ; long rss = - 1 ; switch ( mode ) { case MACOSX_NATIVE : rss = ExecutionEngine . nativeGetRSS ( ) ; break ; case PROCFS : rss = getRSSFromProcFS ( ) ; break ; case PS : rss = PSScraper . getPSData ( pid ) . rss ; break ; } // create a new Datum which adds java stats Datum d = new Datum ( rss ) ; return d ; }
Poll the operating system and generate a Datum