Changeset 4eac98f


Ignore:
Timestamp:
02/10/12 10:09:41 (9 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
9902272
Parents:
66e6d16
Message:
  • Fixed bug where filters were not being applied to rt inputs that were using the event API (thanks Nevil for reporting this)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_rt.c

    rd026488 r4eac98f  
    720720        }
    721721
    722         /* Attempt to read a packet in a non-blocking fashion */
    723         event.size = rt_read_packet_versatile(trace, packet, 0);
    724         if (event.size == -1) {
    725                 read_err = trace_get_err(trace);
    726                 if (read_err.err_num == EAGAIN) {
    727                         /* No data available - do an IOWAIT */
    728                         event.type = TRACE_EVENT_IOWAIT;
    729                 }
     722        do {
     723
     724                event.size = rt_read_packet_versatile(trace, packet, 0);
     725                if (event.size == -1) {
     726                        read_err = trace_get_err(trace);
     727                        if (read_err.err_num == EAGAIN) {
     728                                /* No data available - do an IOWAIT */
     729                                event.type = TRACE_EVENT_IOWAIT;
     730                        }
     731                        else {
     732                                event.type = TRACE_EVENT_PACKET;
     733                                break;
     734                        }
     735                } else if (event.size == 0) {
     736                        /* RT gives us a specific indicator that there will be
     737                         * no more packets. */
     738                        if (packet->type == TRACE_RT_END_DATA)
     739                                event.type = TRACE_EVENT_TERMINATE;
     740                        else
     741                                /* Since several RT messages can have zero-byte
     742                                 * length (once the framing is removed), an
     743                                 * event size of zero can still indicate a
     744                                 * PACKET event */
     745                                event.type = TRACE_EVENT_PACKET;
     746
     747                }       
    730748                else {
    731749                        event.type = TRACE_EVENT_PACKET;
    732750                }
    733         } else if (event.size == 0) {
    734                 /* RT gives us a specific indicator that there will be no
    735                  * more packets. */
    736                 if (packet->type == TRACE_RT_END_DATA)
    737                         event.type = TRACE_EVENT_TERMINATE;
    738                 else
    739                         /* Since several RT messages can have zero-byte
    740                          * length (once the framing is removed), an event size
    741                          * of zero can still indicate a PACKET event */
    742                         event.type = TRACE_EVENT_PACKET;
    743                
    744         }       
    745         else {
    746                 event.type = TRACE_EVENT_PACKET;
    747         }
    748 
    749        
     751
     752                if (trace->filter && event.type == TRACE_EVENT_PACKET) {
     753                        if (!trace_apply_filter(trace->filter, packet)) {
     754                                trace_clear_cache(packet);
     755                                continue;
     756                        }
     757                }
     758
     759                break; 
     760        } while (1);
     761
    750762        return event;
    751763}
Note: See TracChangeset for help on using the changeset viewer.