[complement-svn] SF.net SVN: complement: [1336] trunk/explore/perf/stem
Status: Pre-Alpha
Brought to you by:
complement
From: <com...@us...> - 2006-10-17 16:17:09
|
Revision: 1336 http://svn.sourceforge.net/complement/?rev=1336&view=rev Author: complement Date: 2006-10-17 09:16:54 -0700 (Tue, 17 Oct 2006) Log Message: ----------- test infrastructure Modified Paths: -------------- trunk/explore/perf/stem/stemload/stemload.cc Added Paths: ----------- trunk/explore/perf/stem/Makefile trunk/explore/perf/stem/stemload.gplot Removed Paths: ------------- trunk/explore/perf/stem/stemload/stemload.gplot Property Changed: ---------------- trunk/explore/perf/stem/stemload/ Added: trunk/explore/perf/stem/Makefile =================================================================== --- trunk/explore/perf/stem/Makefile (rev 0) +++ trunk/explore/perf/stem/Makefile 2006-10-17 16:16:54 UTC (rev 1336) @@ -0,0 +1,36 @@ +# -*- Makefile -*- Time-stamp: <05/12/27 00:00:15 ptr> + +DIRS := stemecho stemload +timeprog := ../../app/utils/time/obj/gcc/so/time + +all: + for d in $(DIRS); do \ + (cd $$d; ${MAKE} release-shared); \ + done + +depend: + for d in $(DIRS); do \ + (cd $$d; ${MAKE} depend); \ + done + +clean: + for d in $(DIRS); do \ + (cd $$d; ${MAKE} clean); \ + done + rm -rf stemload/log + +clobber: + for d in $(DIRS); do \ + (cd $$d; ${MAKE} clobber); \ + done + rm -rf stemload/log + +test: + (cd stemecho; ../${timeprog} -o ../echo.dat obj/gcc/so/stemecho 2>/dev/null &) + (cd stemload; rm -rf log; mkdir log; ../${timeprog} -o ../load.dat obj/gcc/so/stemload) + pkill -TERM stemecho + cat stemload/log/*_log.* | sort -n -k 2 | awk 'BEGIN { m = 0.0 } { if ( NR == 1 ) { m = $$2; }; print $$1, $$2 - m, $$3; }' > load.log + awk 'BEGIN {i1 = 0.0; n = 0; sq1 = 0; dt = 30.0; t0 = 0.0; } { if ( ($$2 - t0) > dt ) { print t0 + 0.5 * dt, (i1 / n), sqrt((sq1 - (i1^2)/n ) / n); t0 += dt; i1 = $$3; n = 1; sq1 = $$3^2; } else { i1 += $$3; ++n; sq1 += $$3^2; }; } END {print t0 + 0.5 * dt, (i1 / n), sqrt((sq1 - (i1^2)/n ) / n); t0 += dt; }' load.log > stat.dat + +.PHONY: all depend clean clobber test + Property changes on: trunk/explore/perf/stem/stemload ___________________________________________________________________ Name: svn:ignore - obj core + obj core log Modified: trunk/explore/perf/stem/stemload/stemload.cc =================================================================== --- trunk/explore/perf/stem/stemload/stemload.cc 2006-10-17 09:22:10 UTC (rev 1335) +++ trunk/explore/perf/stem/stemload/stemload.cc 2006-10-17 16:16:54 UTC (rev 1336) @@ -24,23 +24,33 @@ void echo( const stem::Event& ); void loop(); + static Mutex thcount_lock; + static int thcount; + static Condition last; + private: NetTransportMgr echosrv; addr_type echo_addr; ofstream timing; int n; + int lcount; DECLARE_RESPONSE_TABLE( Simulator, stem::EventHandler ); }; +Mutex Simulator::thcount_lock; +int Simulator::thcount = 0; +Condition Simulator::last; + Simulator::Simulator( int i ) : - n( i ) + n( i ), + lcount( 300 ) { echo_addr = echosrv.open( "localhost", 6995 ); stringstream s; - s << "stemload_log." << i; + s << "log/stemload_log." << i; timing.open( s.str().c_str() ); } @@ -55,7 +65,7 @@ unsigned sand = 0; - while ( true ) { + while ( lcount-- > 0 ) { Event ev( 0x5000 ); ev.dest( echo_addr ); @@ -108,27 +118,40 @@ Thread::ret_code client_thread( void *p ) { + Simulator::thcount_lock.lock(); + ++Simulator::thcount; + Simulator::thcount_lock.unlock(); + + Thread::ret_code rc; + rc.iword = 0; + Simulator simulator( (int)p ); simulator.loop(); + + Simulator::thcount_lock.lock(); + if ( --Simulator::thcount == 0 ) { + Simulator::last.set( true ); + } + Simulator::thcount_lock.unlock(); + + return rc; } int main() { - Condition cnd; - - cnd.set( false ); + Simulator::last.set( false ); timespec tm; tm.tv_sec = 0; tm.tv_nsec = 100000000; - for ( int i = 0; i < 1000; ++i ) { - new Thread( client_thread, (void *)i, 0, 0, PTHREAD_STACK_MIN * 2 ); + for ( int i = 0; i < 400; ++i ) { + new Thread( client_thread, (void *)i, 0, Thread::detached, PTHREAD_STACK_MIN * 2 ); Thread::delay( &tm ); } - cnd.wait(); + Simulator::last.try_wait(); return 0; } Deleted: trunk/explore/perf/stem/stemload/stemload.gplot =================================================================== --- trunk/explore/perf/stem/stemload/stemload.gplot 2006-10-17 09:22:10 UTC (rev 1335) +++ trunk/explore/perf/stem/stemload/stemload.gplot 2006-10-17 16:16:54 UTC (rev 1336) @@ -1,4 +0,0 @@ -#!/usr/bin/env gnuplot - -plot 'stemload.log' using ($2 - 1158855155.402390):($3) w d -pause (-1) Copied: trunk/explore/perf/stem/stemload.gplot (from rev 1319, trunk/explore/perf/stem/stemload/stemload.gplot) =================================================================== --- trunk/explore/perf/stem/stemload.gplot (rev 0) +++ trunk/explore/perf/stem/stemload.gplot 2006-10-17 16:16:54 UTC (rev 1336) @@ -0,0 +1,7 @@ +#!/usr/bin/env gnuplot + +set logscale y +plot 'load.log' using ($2):($3) w d lt 1, \ + 'stat.dat' using ($1):($2) w l lt 2, \ + 'stat.dat' using ($1):($2):($3) w yerrorbars lt 2 +pause (-1) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |