Changeset 7 for trunk/lib/nanownlib/stats.py
- Timestamp:
- 07/09/15 12:58:10 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/nanownlib/stats.py
r6 r7 229 229 230 230 def subseries(db, probe_type, unusual_case, size=None, offset=None, field='packet_rtt'): 231 cursor = db.conn.cursor() 232 cursor.execute("SELECT max(c) FROM (SELECT count(sample) c FROM probes WHERE type=? GROUP BY test_case)", (probe_type,)) 233 population_size = cursor.fetchone()[0] 231 population_size = db.populationSize(probe_type) 234 232 235 233 if size == None or size > population_size: … … 248 246 249 247 params = {"probe_type":probe_type, "unusual_case":unusual_case, "offset":offset, "size":size} 248 cursor = db.conn.cursor() 250 249 cursor.execute(query, params) 251 for row in cursor: 252 size -= 1 253 yield dict(row) 254 250 ret_val = [dict(row) for row in cursor.fetchall()] 251 #for row in cursor: 252 # size -= 1 253 # yield dict(row) 254 255 size -= len(ret_val) 255 256 if size > 0: 256 257 params['offset'] = 0 257 258 params['size'] = size 258 259 cursor.execute(query, params) 259 for row in cursor: 260 yield dict(row) 261 260 ret_val += [dict(row) for row in cursor.fetchall()] 261 #for row in cursor: 262 # yield dict(row) 263 264 return ret_val 265 262 266 263 267 # if test_cases=None, include all of them. Otherwise, include only the specified test cases.
Note: See TracChangeset
for help on using the changeset viewer.