Changeset 6fb691b


Ignore:
Timestamp:
02/28/17 14:20:50 (4 years ago)
Author:
Shane Alcock <salcock@…>
Branches:
cachetimestamps, develop, dpdk-ndag, etsilive, master, ndag_format, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance
Children:
204d65b
Parents:
c9ce7ab (diff), db84bb2 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'ringtimestampfixes' into develop

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • lib/format_dag25.c

    r5e3f16c rdb84bb2  
    13131313
    13141314        packet->trace = libtrace;
     1315
    13151316        /* Prepare the libtrace packet */
    13161317        if (dag_prepare_packet_stream(libtrace, stream_data, packet, erfptr,
     
    13241325        }
    13251326
     1327        packet->order = erf_get_erf_timestamp(packet);
    13261328        packet->error = packet->payload ? htons(erfptr->rlen) :
    13271329                                          erf_get_framing_length(packet);
  • lib/format_dpdk.c

    r174b3c7 rdb84bb2  
    21542154        int i;
    21552155        dpdk_per_stream_t *stream = t->format_data;
     2156        struct dpdk_addt_hdr * hdr;
    21562157
    21572158        nb_rx = dpdk_read_packet_stream (libtrace, stream, &t->messages,
     
    21702171                        packets[i]->trace = libtrace;
    21712172                        packets[i]->error = 1;
     2173                        hdr = (struct dpdk_addt_hdr *)
     2174                                        ((struct rte_mbuf*) pkts_burst[i] + 1);
     2175                        packets[i]->order = hdr->timestamp;
    21722176                        dpdk_prepare_packet(libtrace, packets[i], packets[i]->buffer, packets[i]->type, 0);
    21732177                }
  • lib/format_linux_common.c

    r1d780e4 rdb84bb2  
    315315        libtrace_filter_t *filter = FORMAT_DATA->filter;
    316316
     317        stream->last_timestamp = 0;
     318
    317319        /* Create a raw socket for reading packets on */
    318320        stream->fd = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
  • lib/format_linux_common.h

    ree6e802 rdb84bb2  
    257257         * that every ring can get setup the same */
    258258        libtrace_list_t *per_stream;
     259
    259260};
    260261
     
    287288        /* The ring buffer layout */
    288289        struct tpacket_req req;
     290        uint64_t last_timestamp;
    289291} ALIGN_STRUCT(CACHE_LINE_SIZE);
    290292
    291 #define ZERO_LINUX_STREAM {-1, MAP_FAILED, 0, {0,0,0,0}}
     293#define ZERO_LINUX_STREAM {-1, MAP_FAILED, 0, {0,0,0,0}, 0}
    292294
    293295
  • lib/format_linux_int.c

    r5e3f16c rdb84bb2  
    286286        }
    287287
     288
    288289        /* Buffer contains all of our packet (including our custom header) so
    289290         * we just need to get prepare_packet to set all our packet pointers
     
    294295                return -1;
    295296       
     297        if (hdr->timestamptype == TS_TIMEVAL) {
     298                packet->order = (((uint64_t)hdr->tv.tv_sec) << 32)
     299                            + ((((uint64_t)hdr->tv.tv_usec) << 32) /1000000);
     300        } else if (hdr->timestamptype == TS_TIMESPEC) {
     301                packet->order = (((uint64_t)hdr->ts.tv_sec) << 32)
     302                            + ((((uint64_t)hdr->ts.tv_nsec) << 32) /1000000000);
     303        } else {
     304                packet->order = 0;
     305        }
     306
     307        if (packet->order <= stream->last_timestamp) {
     308                packet->order = stream->last_timestamp + 1;
     309        }
     310
     311        stream->last_timestamp = packet->order;
     312
    296313        return hdr->wirelen+sizeof(*hdr);
    297314}
  • lib/format_linux_ring.c

    r47c4490 rdb84bb2  
    520520                }
    521521        }
    522 
    523522        packet->buffer = header;
    524523        packet->trace = libtrace;
     524       
    525525        header->tp_status = TP_STATUS_LIBTRACE;
    526526
     
    537537        stream->rxring_offset++;
    538538        stream->rxring_offset %= stream->req.tp_frame_nr;
     539
     540        packet->order = (((uint64_t)TO_TP_HDR2(packet->buffer)->tp_sec) << 32)
     541                        + ((((uint64_t)TO_TP_HDR2(packet->buffer)->tp_nsec)
     542                        << 32) / 1000000000);
     543
     544        if (packet->order <= stream->last_timestamp) {
     545                packet->order = stream->last_timestamp + 1;
     546        }
     547
     548        stream->last_timestamp = packet->order;
     549               
    539550
    540551        /* We just need to get prepare_packet to set all our packet pointers
  • lib/trace_parallel.c

    rceba2b2 rdb84bb2  
    677677                        if (!trace->pread) {
    678678                                assert(packets[0]);
     679                                ASSERT_RET(pthread_mutex_lock(&trace->libtrace_lock), == 0);
    679680                                nb_packets = trace_read_packet(trace, packets[0]);
     681                                ASSERT_RET(pthread_mutex_unlock(&trace->libtrace_lock), == 0);
    680682                                packets[0]->error = nb_packets;
    681683                                if (nb_packets > 0)
     
    13421344                                        trace_set_capture_length(packets[i],
    13431345                                                        libtrace->snaplen);
    1344                                 trace_packet_set_order(packets[i], trace_get_erf_timestamp(packets[i]));
    13451346                        }
    13461347                } while(ret == 0);
  • test/test-live.c

    r8decff7 rcac1d92  
    171171        if (!stat->received_valid) {
    172172                printf("\tInfo: trace does not support received counter\n");
    173         } else if (stat->received != 100) {
    174                 ERROR("Trace received %zu/100 packets\n", stat->received);
     173        } else if (stat->received != (uint32_t) test_size) {
     174                ERROR("Trace received %zu/%u packets\n", stat->received,
     175                                (uint32_t)test_size);
    175176        }
    176177
  • tools/tracertstats/tracertstats.c

    ree6e802 r0b4b388  
    258258        }
    259259        trace_set_combiner(trace, &combiner_ordered, (libtrace_generic_t){0});
    260         trace_set_tracetime(trace, true);
    261260        trace_set_perpkt_threads(trace, threadcount);
    262261        trace_set_burst_size(trace, burstsize);
     
    264263        if (trace_get_information(trace)->live) {
    265264                trace_set_tick_interval(trace, (int) (packet_interval * 1000));
     265        } else {
     266                trace_set_tracetime(trace, true);
    266267        }
    267268
Note: See TracChangeset for help on using the changeset viewer.