Mercurial > repos > icfp2013
comparison src/solver.tp @ 44:e795f7179456
Print some timestamps of request times in solver
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 11 Aug 2013 02:16:44 -0700 |
parents | 1cadb591eef1 |
children | 855c05c9cae1 |
comparison
equal
deleted
inserted
replaced
43:96b2fcb746bf | 44:e795f7179456 |
---|---|
136 } | 136 } |
137 root | 137 root |
138 } | 138 } |
139 | 139 |
140 solve:withAuth:andInfo:andProg <- :progId :authKey :info :prog { | 140 solve:withAuth:andInfo:andProg <- :progId :authKey :info :prog { |
141 start <- os time | |
141 resp <- (requests evalId: progId (info allInputs)) sendWithKey: authKey | 142 resp <- (requests evalId: progId (info allInputs)) sendWithKey: authKey |
143 end <- os time | |
142 if: (resp status) = "ok" { | 144 if: (resp status) = "ok" { |
145 print: "Start: " . (string: start) . ", End: " . (string: start) . "Duration: " . (string: end - start) | |
143 matches <- info findMatches: (resp outputs) at: 0 | 146 matches <- info findMatches: (resp outputs) at: 0 |
144 noSuccess <- true | 147 noSuccess <- true |
145 cur <- 0 | 148 cur <- 0 |
146 if: (matches length) = 0 { | 149 if: (matches length) = 0 { |
147 print: "No matches? :(\n" | 150 print: "No matches? :(\n" |
148 print: info | 151 print: info |
149 } | 152 } |
150 while: { noSuccess && cur < (matches length) } do: { | 153 while: { noSuccess && cur < (matches length) } do: { |
151 prog root!: (matches get: cur) | 154 prog root!: (matches get: cur) |
155 gstart <- os time | |
152 gresp <- (requests guess: progId (string: prog)) sendWithKey: authKey | 156 gresp <- (requests guess: progId (string: prog)) sendWithKey: authKey |
157 gend <- os time | |
158 print: "Start: " . (string: gstart) . ", End: " . (string: gend) . "Duration: " . (string: gend - gstart) | |
153 if: (gresp status) = "win" { | 159 if: (gresp status) = "win" { |
154 noSuccess <- false | 160 noSuccess <- false |
155 } else: { | 161 } else: { |
156 if: (gresp status) = "mismatch" { | 162 if: (gresp status) = "mismatch" { |
157 failInput <- (gresp values) get: 0 | 163 failInput <- (gresp values) get: 0 |