Overview
Comment: | Added db stats gathering |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.60 |
Files: | files | file ages | folders |
SHA1: |
cf842b155ec3031611d636b711ad5cd6 |
User & Date: | matt on 2014-10-06 05:38:27 |
Other Links: | branch diff | manifest | tags |
Context
2014-10-06
| ||
14:51 | Added db performance sensing check-in: ba1a890094 user: mrwellan tags: v1.60 | |
05:38 | Added db stats gathering check-in: cf842b155e user: matt tags: v1.60 | |
00:05 | Keep servers alive only if have RUNNING or REMOTEHOSTSTART tests check-in: e2b136c3de user: matt tags: v1.60 | |
Changes
Modified common.scm from [0dac47ec76] to [090cb13503].
︙ | ︙ | |||
48 49 50 51 52 53 54 55 56 57 58 59 60 61 | (define *passnum* 0) ;; when running track calls to run-tests or similar (define *write-frequency* (make-hash-table)) ;; run-id => (vector (current-seconds) 0)) (define *alt-log-file* #f) ;; used by -log (define *db-sync-mutex* (make-mutex)) ;; DATABASE (define *dbstruct-db* #f) ;; SERVER (define *my-client-signature* #f) (define *transport-type* 'http) (define *megatest-db* #f) (define *rpc:listener* #f) ;; if set up for server communication this will hold the tcp port (define *runremote* (make-hash-table)) ;; if set up for server communication this will hold <host port> | > > | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | (define *passnum* 0) ;; when running track calls to run-tests or similar (define *write-frequency* (make-hash-table)) ;; run-id => (vector (current-seconds) 0)) (define *alt-log-file* #f) ;; used by -log (define *db-sync-mutex* (make-mutex)) ;; DATABASE (define *dbstruct-db* #f) (define *db-stats* (make-hash-table)) ;; hash of vectors < count duration-total > (define *db-stats-mutex* (make-mutex)) ;; SERVER (define *my-client-signature* #f) (define *transport-type* 'http) (define *megatest-db* #f) (define *rpc:listener* #f) ;; if set up for server communication this will hold the tcp port (define *runremote* (make-hash-table)) ;; if set up for server communication this will hold <host port> |
︙ | ︙ |
Modified megatest.scm from [a6b79b9361] to [f0ffc3a3a5].
︙ | ︙ | |||
344 345 346 347 348 349 350 351 352 353 354 355 356 357 | (if (args:get-arg "-itempatt") (let ((newval (conc (args:get-arg "-testpatt") "/" (args:get-arg "-itempatt")))) (debug:print 0 "WARNING: -itempatt has been deprecated, please use -testpatt testpatt/itempatt method, new testpatt is "newval) (hash-table-set! args:arg-hash "-testpatt" newval) (hash-table-delete! args:arg-hash "-itempatt"))) (on-exit (lambda () (if *dbstruct-db* (db:close-all *dbstruct-db*)) (if *megatest-db* (sqlite3:finalize! *megatest-db*)))) ;;====================================================================== ;; Misc general calls ;;====================================================================== | > > > > > > > > > | 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | (if (args:get-arg "-itempatt") (let ((newval (conc (args:get-arg "-testpatt") "/" (args:get-arg "-itempatt")))) (debug:print 0 "WARNING: -itempatt has been deprecated, please use -testpatt testpatt/itempatt method, new testpatt is "newval) (hash-table-set! args:arg-hash "-testpatt" newval) (hash-table-delete! args:arg-hash "-itempatt"))) (on-exit (lambda () (debug:print 18 "DB Stats") (debug:print 18 "Cmd\tCount\tTot time\tAvg") (for-each (lambda (cmd) (let ((cmd-dat (hash-table-ref *db-stats* cmd))) (debug:print 18 cmd "\t" (vector-ref cmd-dat 0) "\t" (vector-ref cmd-dat 1) "\t" (/ (vector-ref cmd-dat 1) (vector-ref cmd-dat 0))))) (sort (hash-table-keys *db-stats*) (lambda (a b) (> (vector-ref (hash-table-ref *db-stats* a) 0) (vector-ref (hash-table-ref *db-stats* b) 0))))) (if *dbstruct-db* (db:close-all *dbstruct-db*)) (if *megatest-db* (sqlite3:finalize! *megatest-db*)))) ;;====================================================================== ;; Misc general calls ;;====================================================================== |
︙ | ︙ |
Modified rmt.scm from [4cb886426c] to [9f1fa5ad0d].
︙ | ︙ | |||
80 81 82 83 84 85 86 87 88 89 90 91 92 93 | (debug:print 0 "WARNING: Communication failed, trying call to http-transport:client-api-send-receive again.") (rmt:send-receive cmd run-id params)))) (begin (debug:print-info 4 "no server and read-only query, bypassing normal channel") (if (rmt:write-frequency-over-limit? cmd run-id)(server:kind-run run-id)) (rmt:open-qry-close-locally cmd run-id params))))) (define (rmt:open-qry-close-locally cmd run-id params) (let* ((dbdir (conc (configf:lookup *configdat* "setup" "linktree") "/.db")) (dbstruct-local (if *dbstruct-db* *dbstruct-db* (let ((db (make-dbr:dbstruct path: dbdir local: #t))) (set! *dbstruct-db* db) db))) | > > > > > > > > > > > | | > | < > > | | 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | (debug:print 0 "WARNING: Communication failed, trying call to http-transport:client-api-send-receive again.") (rmt:send-receive cmd run-id params)))) (begin (debug:print-info 4 "no server and read-only query, bypassing normal channel") (if (rmt:write-frequency-over-limit? cmd run-id)(server:kind-run run-id)) (rmt:open-qry-close-locally cmd run-id params))))) (define (rmt:update-db-stats cmd duration) (mutex-lock! *db-stats-mutex*) (let ((stat-vec (hash-table-ref/default *db-stats* cmd #f))) (if (not stat-vec) (let ((newvec (vector 0 0))) (hash-table-set! *db-stats* cmd newvec) (set! stat-vec newvec))) (vector-set! stat-vec 0 (+ (vector-ref stat-vec 0) 1)) (vector-set! stat-vec 1 (+ (vector-ref stat-vec 1) duration))) (mutex-unlock! *db-stats-mutex*)) (define (rmt:open-qry-close-locally cmd run-id params) (let* ((dbdir (conc (configf:lookup *configdat* "setup" "linktree") "/.db")) (dbstruct-local (if *dbstruct-db* *dbstruct-db* (let ((db (make-dbr:dbstruct path: dbdir local: #t))) (set! *dbstruct-db* db) db))) (db-file-path (db:dbfile-path 0))) ;; (read-only (not (file-read-access? db-file-path))) (let* ((start (current-milliseconds)) (res (api:execute-requests dbstruct-local (symbol->string cmd) params)) (duration (- (current-milliseconds) start))) (rmt:update-db-stats cmd duration) res))) (define (rmt:send-receive-no-auto-client-setup connection-info cmd run-id params) (let* ((run-id (if run-id run-id 0)) (jparams (db:obj->string params)) ;; (rmt:dat->json-str params)) (res (http-transport:client-api-send-receive run-id connection-info cmd jparams))) (if res (db:string->obj res) |
︙ | ︙ |
Modified runs.scm from [080b4283f7] to [8478824409].
︙ | ︙ | |||
1068 1069 1070 1071 1072 1073 1074 | (begin ;; Here we mark any old defunct tests as incomplete. Do this every fifteen minutes ;; (debug:print 0 "Got here eh! num-running=" num-running " (> num-running 0) " (> num-running 0)) (if (> (current-seconds)(+ last-time-incomplete 900)) (begin (debug:print-info 0 "Marking stuck tests as INCOMPLETE while waiting for run " run-id ". Running as pid " (current-process-id) " on " (get-host-name)) (set! last-time-incomplete (current-seconds)) | | | 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | (begin ;; Here we mark any old defunct tests as incomplete. Do this every fifteen minutes ;; (debug:print 0 "Got here eh! num-running=" num-running " (> num-running 0) " (> num-running 0)) (if (> (current-seconds)(+ last-time-incomplete 900)) (begin (debug:print-info 0 "Marking stuck tests as INCOMPLETE while waiting for run " run-id ". Running as pid " (current-process-id) " on " (get-host-name)) (set! last-time-incomplete (current-seconds)) (rmt:find-and-mark-incomplete run-id))) (if (not (eq? num-running prev-num-running)) (debug:print-info 0 "run-wait specified, waiting on " num-running " tests in RUNNING, REMOTEHOSTSTART or LAUNCHED state at " (time->string (seconds->local-time (current-seconds))))) (thread-sleep! 15) ;; (wait-loop (rmt:get-count-tests-running-for-run-id run-id) num-running)))) (wait-loop (rmt:get-count-tests-running-for-run-id run-id) num-running)))) ;; LET* ((test-record ;; we get here on "drop through". All done! |
︙ | ︙ |