@@ -58,6 +58,8 @@ text_filter::revert_to_last(logfile_filter_state& lfs, size_t rollback_size)
5858 = lfs.tfs_last_message_matched [this ->lf_index ];
5959 lfs.tfs_lines_for_message [this ->lf_index ]
6060 = lfs.tfs_last_lines_for_message [this ->lf_index ];
61+ lfs.tfs_hits_for_message [this ->lf_index ]
62+ = lfs.tfs_last_hits_for_message [this ->lf_index ];
6163
6264 for (size_t lpc = 0 ; lpc < lfs.tfs_lines_for_message [this ->lf_index ]; lpc++)
6365 {
@@ -92,6 +94,9 @@ text_filter::add_line(logfile_filter_state& lfs,
9294 lfs.tfs_message_matched [this ->lf_index ]
9395 = lfs.tfs_message_matched [this ->lf_index ] || retval;
9496 lfs.tfs_lines_for_message [this ->lf_index ] += 1 ;
97+ if (retval) {
98+ lfs.tfs_hits_for_message [this ->lf_index ] += 1 ;
99+ }
95100
96101 return retval;
97102}
@@ -117,16 +122,18 @@ text_filter::end_of_message(logfile_filter_state& lfs)
117122 lfs.tfs_mask [line_number] &= ~mask;
118123 }
119124 lfs.tfs_filter_count [this ->lf_index ] += 1 ;
120- if (lfs.tfs_message_matched [this ->lf_index ]) {
121- lfs.tfs_filter_hits [this ->lf_index ] += 1 ;
122- }
123125 }
126+ lfs.tfs_filter_hits [this ->lf_index ]
127+ += lfs.tfs_hits_for_message [this ->lf_index ];
124128 lfs.tfs_last_message_matched [this ->lf_index ]
125129 = lfs.tfs_message_matched [this ->lf_index ];
126130 lfs.tfs_last_lines_for_message [this ->lf_index ]
127131 = lfs.tfs_lines_for_message [this ->lf_index ];
132+ lfs.tfs_last_hits_for_message [this ->lf_index ]
133+ = lfs.tfs_hits_for_message [this ->lf_index ];
128134 lfs.tfs_message_matched [this ->lf_index ] = false ;
129135 lfs.tfs_lines_for_message [this ->lf_index ] = 0 ;
136+ lfs.tfs_hits_for_message [this ->lf_index ] = 0 ;
130137}
131138
132139void
@@ -1604,6 +1611,7 @@ logfile_filter_state::logfile_filter_state(std::shared_ptr<logfile> lf)
16041611 memset (this ->tfs_filter_hits , 0 , sizeof (this ->tfs_filter_hits ));
16051612 memset (this ->tfs_message_matched , 0 , sizeof (this ->tfs_message_matched ));
16061613 memset (this ->tfs_lines_for_message , 0 , sizeof (this ->tfs_lines_for_message ));
1614+ memset (this ->tfs_hits_for_message , 0 , sizeof (this ->tfs_hits_for_message ));
16071615 memset (this ->tfs_last_message_matched ,
16081616 0 ,
16091617 sizeof (this ->tfs_last_message_matched ));
@@ -1623,10 +1631,12 @@ logfile_filter_state::clear()
16231631void
16241632logfile_filter_state::clear_for_rebuild ()
16251633{
1634+ log_debug (" clearing filter state" );
16261635 memset (this ->tfs_filter_count , 0 , sizeof (this ->tfs_filter_count ));
16271636 memset (this ->tfs_filter_hits , 0 , sizeof (this ->tfs_filter_hits ));
16281637 memset (this ->tfs_message_matched , 0 , sizeof (this ->tfs_message_matched ));
16291638 memset (this ->tfs_lines_for_message , 0 , sizeof (this ->tfs_lines_for_message ));
1639+ memset (this ->tfs_hits_for_message , 0 , sizeof (this ->tfs_hits_for_message ));
16301640 memset (this ->tfs_last_message_matched ,
16311641 0 ,
16321642 sizeof (this ->tfs_last_message_matched ));
@@ -1644,6 +1654,7 @@ logfile_filter_state::clear_filter_state(size_t index)
16441654 this ->tfs_filter_hits [index] = 0 ;
16451655 this ->tfs_message_matched [index] = false ;
16461656 this ->tfs_lines_for_message [index] = 0 ;
1657+ this ->tfs_hits_for_message [index] = 0 ;
16471658 this ->tfs_last_message_matched [index] = false ;
16481659 this ->tfs_last_lines_for_message [index] = 0 ;
16491660}
0 commit comments