Changeset 85e87b5


Ignore:
Timestamp:
06/23/14 13:42:35 (6 years ago)
Author:
Richard Sanger <rsangerarj@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, 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:
014f733
Parents:
b13b939
Message:

Automatically scale threads to the number of available CPU cores on Linux.

Location:
lib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • lib/libtrace.h.in

    rb13b939 r85e87b5  
    31543154DLLEXPORT void trace_packet_set_order(libtrace_packet_t * packet, uint64_t order);
    31553155DLLEXPORT void trace_packet_set_hash(libtrace_packet_t * packet, uint64_t hash);
    3156 DLLEXPORT inline uint64_t tv_to_usec(struct timeval *tv);
     3156DLLEXPORT uint64_t tv_to_usec(struct timeval *tv);
    31573157
    31583158DLLEXPORT int retrive_first_packet(libtrace_t *libtrace, libtrace_packet_t **packet, struct timeval **tv);
  • lib/trace.c

    rb13b939 r85e87b5  
    765765                                 */
    766766        free(packet);
    767 }       
     767}
    768768
    769769/**
  • lib/trace_parallel.c

    rb13b939 r85e87b5  
    9898#include <pthread.h>
    9999#include <signal.h>
    100 
     100#include <unistd.h>
    101101
    102102extern int libtrace_parallel;
     
    895895
    896896
    897 DLLEXPORT inline uint64_t tv_to_usec(struct timeval *tv)
     897DLLEXPORT uint64_t tv_to_usec(struct timeval *tv)
    898898{
    899899        return (uint64_t) tv->tv_sec*1000000ull + (uint64_t) tv->tv_usec;
     
    11461146                libtrace->perpkt_buffer_size = 1000;
    11471147
    1148         if (libtrace->perpkt_thread_count <= 0)
    1149                 libtrace->perpkt_thread_count = 2; // XXX scale to system
     1148        if (libtrace->perpkt_thread_count <= 0) {
     1149                // TODO add BSD support
     1150                libtrace->perpkt_thread_count = sysconf(_SC_NPROCESSORS_ONLN);
     1151                if (libtrace->perpkt_thread_count <= 0)
     1152                        // Lets just use one
     1153                        libtrace->perpkt_thread_count = 1;
     1154        }
    11501155
    11511156        if(libtrace->packet_freelist_size <= 0)
Note: See TracChangeset for help on using the changeset viewer.