@@ -328,19 +328,27 @@ def communication(self):
328
328
combined = self .read .communication ()
329
329
combined .extend (self .write .communication ())
330
330
331
- combined .sort (key = lambda x : x [1 ].id )
331
+ combined .sort (key = lambda x : x [1 ].index )
332
332
333
333
# Now we no longer need the irp relations.
334
334
return [x [0 ] for x in combined ]
335
335
336
336
337
337
# Helper to hold the relevant fields from the log records.
338
338
Irp = namedtuple ("Irp" , [
339
- "id" ,
339
+ # The index of this Irp record in the original file.
340
+ "index" ,
341
+ # The irp id, this seems to wrap around.
342
+ "irp_id" ,
343
+ # Major function
340
344
"function" ,
345
+ # Time string
341
346
"time" ,
347
+ # Status a reported in IOSB.Status constant
342
348
"status" ,
349
+ # IRP address, to track start and finish
343
350
"address" ,
351
+ # Data of the request.
344
352
"data" ,
345
353
])
346
354
@@ -383,6 +391,7 @@ def parse_log_file(file):
383
391
384
392
records = []
385
393
394
+ irp_index = 0
386
395
for line_nr , line in enumerate (file ):
387
396
if line .startswith ("ID =" ):
388
397
irp_id = int (line .split ('=' , 1 )[1 ].strip ())
@@ -411,7 +420,8 @@ def parse_log_file(file):
411
420
412
421
if not discard :
413
422
record = Irp (
414
- id = irp_id ,
423
+ index = irp_index ,
424
+ irp_id = irp_id ,
415
425
function = function ,
416
426
time = curtime ,
417
427
status = status_constant ,
@@ -423,6 +433,7 @@ def parse_log_file(file):
423
433
data = False
424
434
discard = False
425
435
lines = []
436
+ irp_index += 1
426
437
427
438
return records
428
439
@@ -474,7 +485,7 @@ def parse_json_file(path):
474
485
475
486
records = []
476
487
# Now we have good and clean data.
477
- for entry in irp_entries :
488
+ for irp_index , entry in enumerate ( irp_entries ) :
478
489
if entry .get ("Driver name" ) != TARGET_DRIVER :
479
490
continue
480
491
@@ -494,7 +505,8 @@ def parse_json_file(path):
494
505
status_constant = Status [entry .get ("IOSB.Status constant" )]
495
506
irp_address = int (entry .get ("IRP address" ), 0 )
496
507
record = Irp (
497
- id = irp_id ,
508
+ index = irp_index ,
509
+ irp_id = irp_id ,
498
510
function = function ,
499
511
time = curtime ,
500
512
status = status_constant ,
0 commit comments