Changeset 05b65ae


Ignore:
Timestamp:
11/08/17 12:02:07 (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:
0317e3c
Parents:
e68325b
Message:

Tweaked inline functions in format_ndag.c

Some functions had their inline status removed, as they were
probably doing too much work to be worth inlining.

Removed read_required() function and just put the checks in the
function that used to call it.

Changed readable_data() to take a streamsock_t *, rather than a
streamsock_t -- the overhead of needlessly copying the structure
was noticeable.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/format_ndag.c

    re68325b r05b65ae  
    104104}
    105105
    106 static inline uint8_t check_ndag_header(char *msgbuf, uint32_t msgsize) {
     106static uint8_t check_ndag_header(char *msgbuf, uint32_t msgsize) {
    107107        ndag_common_t *header = (ndag_common_t *)msgbuf;
    108108
     
    258258}
    259259
    260 static inline void new_group_alert(libtrace_t *libtrace, uint16_t threadid,
     260static void new_group_alert(libtrace_t *libtrace, uint16_t threadid,
    261261                uint16_t portnum, uint16_t monid) {
    262262
     
    430430}
    431431
    432 static inline int ndag_start_threads(libtrace_t *libtrace, uint32_t maxthreads)
     432static int ndag_start_threads(libtrace_t *libtrace, uint32_t maxthreads)
    433433{
    434434        int ret;
     
    685685}
    686686
    687 static inline int readable_data(streamsock_t ssock) {
    688 
    689         if (ssock.sock == -1) {
     687static inline int readable_data(streamsock_t *ssock) {
     688
     689        if (ssock->sock == -1) {
    690690                return 0;
    691691        }
    692         if (ssock.savedsize[ssock.nextreadind] == 0) {
     692        if (ssock->savedsize[ssock->nextreadind] == 0) {
    693693                return 0;
    694694        }
    695         if (ssock.nextread - ssock.saved[ssock.nextreadind] >=
    696                         ssock.savedsize[ssock.nextreadind]) {
     695        if (ssock->nextread - ssock->saved[ssock->nextreadind] >=
     696                        ssock->savedsize[ssock->nextreadind]) {
    697697                return 0;
    698698        }
     
    701701
    702702}
    703 
    704 static inline int read_required(streamsock_t ssock) {
    705         if (ssock.sock == -1)
    706                 return 0;
    707         if (ssock.savedsize[ssock.nextwriteind] == 0)
    708                 return 1;
    709         //if (ssock.nextread - ssock.saved >= ssock.savedsize)
    710         //        return 1;
    711         return 0;
    712 }
    713 
    714703
    715704static int receive_from_sockets(recvstream_t *rt) {
     
    726715                ndag_encap_t *encaphdr;
    727716
    728                 if (!read_required(rt->sources[i])) {
    729                         if (rt->sources[i].sock != -1) {
    730                                 readybufs ++;
    731                         }
     717                if (rt->sources[i].sock == -1) {
     718                        continue;
     719                } else if (rt->sources[i].savedsize[rt->sources[i].nextwriteind] != 0) {
     720                        readybufs ++;
    732721                        continue;
    733722                }
     
    743732                         * count as 'ready' if at least one buffer is full */
    744733                        if (errno == EAGAIN || errno == EWOULDBLOCK) {
    745                                 if (readable_data(rt->sources[i])) {
     734                                if (readable_data(&(rt->sources[i]))) {
    746735                                        readybufs ++;
    747736                                }
     
    812801                }
    813802
    814                 readybufs += 1;
     803                readybufs ++;
    815804        }
    816805
     
    885874
    886875        for (i = 0; i < rt->sourcecount; i ++) {
    887                 if (!readable_data(rt->sources[i])) {
     876                if (!readable_data(&(rt->sources[i]))) {
    888877                        continue;
    889878                }
Note: See TracChangeset for help on using the changeset viewer.