Changeset 1257
- Timestamp:
- Dec 10, 2008, 7:57:25 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 3 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lang/tcl/src/Makefile.in
r1082 r1257 55 55 RpRusage.o \ 56 56 RpSignal.o \ 57 RpSysinfo.o \ 57 58 RpUnitsTclInterface.o \ 58 59 RpUtilsTclInterface.o -
trunk/lang/tcl/src/Rappture_Init.c
r1018 r1257 25 25 extern Tcl_AppInitProc RpRusage_Init; 26 26 extern Tcl_AppInitProc RpSignal_Init; 27 extern Tcl_AppInitProc RpSysinfo_Init; 27 28 extern Tcl_AppInitProc RpDaemon_Init; 28 29 … … 72 73 return TCL_ERROR; 73 74 } 75 if (RpSysinfo_Init(interp) != TCL_OK) { 76 return TCL_ERROR; 77 } 74 78 if (RpDaemon_Init(interp) != TCL_OK) { 75 79 return TCL_ERROR; -
trunk/p2p/Makefile
r1251 r1257 1 CC = gcc 2 CFLAGS = -O3 3 1 4 all: 5 $(CC) $(CFLAGS) perftest.c -o perftest 2 6 ./mkindex handler.tcl server.tcl client.tcl log.tcl random.tcl -
trunk/p2p/authority.tcl
r1251 r1257 9 9 # ====================================================================== 10 10 # Copyright (c) 2008 Purdue Research Foundation 11 # 12 # See the file "license.terms" for information on usage and 13 # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 11 14 # ====================================================================== 12 15 -
trunk/p2p/client.tcl
r1251 r1257 6 6 # ====================================================================== 7 7 # Copyright (c) 2008 Purdue Research Foundation 8 # 9 # See the file "license.terms" for information on usage and 10 # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 8 11 # ====================================================================== 9 12 package require Itcl -
trunk/p2p/handler.tcl
r1251 r1257 8 8 # ====================================================================== 9 9 # Copyright (c) 2008 Purdue Research Foundation 10 # 11 # See the file "license.terms" for information on usage and 12 # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 10 13 # ====================================================================== 11 14 package require Itcl -
trunk/p2p/log.tcl
r1251 r1257 5 5 # ====================================================================== 6 6 # Copyright (c) 2008 Purdue Research Foundation 7 # 8 # See the file "license.terms" for information on usage and 9 # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 7 10 # ====================================================================== 8 11 # ---------------------------------------------------------------------- -
trunk/p2p/random.tcl
r1251 r1257 5 5 # ====================================================================== 6 6 # Copyright (c) 2008 Purdue Research Foundation 7 # 8 # See the file "license.terms" for information on usage and 9 # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 7 10 # ====================================================================== 8 11 -
trunk/p2p/server.tcl
r1251 r1257 5 5 # ====================================================================== 6 6 # Copyright (c) 2008 Purdue Research Foundation 7 # 8 # See the file "license.terms" for information on usage and 9 # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 7 10 # ====================================================================== 8 11 package require Itcl -
trunk/p2p/tclIndex
r1251 r1257 10 10 set auto_index(::Handler::protocol) [list source [file join $dir handler.tcl]] 11 11 set auto_index(::Handler::define) [list source [file join $dir handler.tcl]] 12 set auto_index(::Handler::connectionName) [list source [file join $dir handler.tcl]] 12 13 set auto_index(::Handler::connectionSpeaks) [list source [file join $dir handler.tcl]] 13 14 set auto_index(::Handler::handle) [list source [file join $dir handler.tcl]] 14 15 set auto_index(::Handler::finalize) [list source [file join $dir handler.tcl]] 16 set auto_index(::Handler::handlerType) [list source [file join $dir handler.tcl]] 15 17 set auto_index(Server) [list source [file join $dir server.tcl]] 16 18 set auto_index(::Server::port) [list source [file join $dir server.tcl]] 17 19 set auto_index(::Server::accept) [list source [file join $dir server.tcl]] 18 20 set auto_index(::Server::connectionSpeaks) [list source [file join $dir server.tcl]] 21 set auto_index(::Server::handlerType) [list source [file join $dir server.tcl]] 19 22 set auto_index(Client) [list source [file join $dir client.tcl]] 20 23 set auto_index(::Client::send) [list source [file join $dir client.tcl]] 21 24 set auto_index(::Client::address) [list source [file join $dir client.tcl]] 25 set auto_index(::Client::handlerType) [list source [file join $dir client.tcl]] 22 26 set auto_index(log) [list source [file join $dir log.tcl]] 23 27 set auto_index(randomize) [list source [file join $dir random.tcl]] -
trunk/p2p/test.tcl
r1251 r1257 9 9 # ====================================================================== 10 10 # Copyright (c) 2008 Purdue Research Foundation 11 # 12 # See the file "license.terms" for information on usage and 13 # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 11 14 # ====================================================================== 12 15 package require Itcl -
trunk/p2p/worker.tcl
r1251 r1257 10 10 # ====================================================================== 11 11 # Copyright (c) 2008 Purdue Research Foundation 12 # ====================================================================== 12 # 13 # See the file "license.terms" for information on usage and 14 # redistribution of this file, and for a DISCLAIMER OF ALL WARRANTIES. 15 # ====================================================================== 16 package require Rappture 13 17 14 18 # recognize other library files in this same directory … … 41 45 set options(max_peer_connections) 4 42 46 47 # number of seconds between each check of system load 48 set options(time_between_load_checks) 60000 49 43 50 # ====================================================================== 44 51 # PEERS … … 49 56 # list of peers that we're testing connections with 50 57 set peers(testing) "" 58 59 # ====================================================================== 60 # SYSTEM LOAD 61 # ====================================================================== 62 # Check system load every so often. When the load changes 63 # significantly, execute a "perftest" run to compute the current 64 # number of wonks available to this worker. 65 66 set sysload(lastLoad) -1 67 set sysload(wonks) -1 68 set sysload(measured) -1 69 70 after idle worker_load_check 51 71 52 72 # ====================================================================== … … 194 214 # gets restarted in between. 195 215 after $options(time_between_registers) worker_register 216 } 217 218 # ---------------------------------------------------------------------- 219 # COMMAND: worker_load_check 220 # 221 # Invoked when this worker first starts up and periodically thereafter 222 # to compute the system load available to the worker. If the system 223 # load has changed significantly, then the "perftest" program is 224 # executed to get a measure of performance available. This program 225 # returns a number of "wonks" which we report to peers as our available 226 # performance. 227 # ---------------------------------------------------------------------- 228 proc worker_load_check {} { 229 global options sysload dir 230 231 # see if the load has changed significantly 232 set changed 0 233 if {$sysload(lastLoad) < 0} { 234 set changed 1 235 } else { 236 set load [Rappture::sysinfo load5] 237 if {$load < 0.9*$sysload(lastLoad) || $load > 1.1*$sysload(lastLoad)} { 238 set changed 1 239 } 240 } 241 242 if {$changed} { 243 set sysload(lastLoad) [Rappture::sysinfo load5] 244 puts "LOAD CHANGED: $sysload(lastLoad) [Rappture::sysinfo freeram freeswap]" 245 set sysload(measured) [clock seconds] 246 247 # Run the program, but don't use exec, since it blocks. 248 # Instead, run it in the background and harvest its output later. 249 set sysload(test) [open "| [file join $dir perftest]" r] 250 fileevent $sysload(test) readable worker_load_results 251 } 252 253 # monitor the system load at regular intervals 254 after $options(time_between_load_checks) worker_load_check 255 } 256 257 # ---------------------------------------------------------------------- 258 # COMMAND: worker_load_results 259 # 260 # Invoked automatically when the "perftest" run finishes. Reads the 261 # number of wonks reported on standard output and reports them to 262 # other peers. 263 # ---------------------------------------------------------------------- 264 proc worker_load_results {} { 265 global sysload 266 267 if {[catch {read $sysload(test)} msg] == 0} { 268 if {[regexp {[0-9]+} $msg match]} { 269 puts "WONKS: $match" 270 set sysload(wonks) $match 271 } else { 272 log system "ERROR: performance test failed: $msg" 273 } 274 } 275 catch {close $sysload(test)} 276 set sysload(test) "" 196 277 } 197 278
Note: See TracChangeset
for help on using the changeset viewer.