Skip to content

Commit c5c4397

Browse files
author
Eddie Kohler
committed
Timestamp closure.
This checkin adds and documents the necessary configuration and macro magic to detect and use 64-bit integer divide on Linux kernels. At least I think it does.
1 parent 2a06542 commit c5c4397

File tree

7 files changed

+239
-205
lines changed

7 files changed

+239
-205
lines changed

config-ns.h.in

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212

1313
#endif /* __cplusplus */
1414

15+
/* The ns driver probably can't use clock_gettime. */
16+
#define HAVE_USE_CLOCK_GETTIME 0
17+
1518
/* Include userlevel configuration. */
1619
#define CLICK_USERLEVEL 1
1720
#include <click/config-userlevel.h>

config-userlevel.h.in

+9-1
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@ typedef unsigned long uintptr_t;
213213
# define HAVE_MULTITHREAD HAVE_USER_MULTITHREAD
214214
#endif
215215

216+
/* Define HAVE_USE_CLOCK_GETTIME if the clock_gettime function is usable. */
217+
#ifndef HAVE_USE_CLOCK_GETTIME
218+
# if HAVE_DECL_CLOCK_GETTIME && HAVE_CLOCK_GETTIME
219+
# define HAVE_USE_CLOCK_GETTIME 1
220+
# endif
221+
#endif
222+
216223
/* Include assert macro. */
217224
#include <assert.h>
218225

@@ -237,7 +244,8 @@ char *strerror(int errno);
237244

238245
/* Use nanosecond-granularity timestamps if they are enabled. */
239246
#if HAVE_NANOTIMESTAMP_ENABLED
240-
# define HAVE_NANOTIMESTAMP 1
247+
# define TIMESTAMP_NANOSEC 1
248+
# define HAVE_NANOTIMESTAMP 1 /* Deprecated */
241249
#endif
242250

243251
#ifdef __cplusplus

doc/Doxyfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -1044,12 +1044,14 @@ PREDEFINED = CLICK_DECLS= \
10441044
CLICK_DEPRECATED= \
10451045
CLICK_WARN_UNUSED_RESULT= \
10461046
CLICK_ELEMENT_PORT_COUNT_DEPRECATED= \
1047+
CLICK_BYTE_ORDER=4321 \
1048+
CLICK_BIG_ENDIAN=4321 \
10471049
__attribute__(x)= \
10481050
HAVE_INT64_TYPES \
10491051
HAVE_INT64_DIVIDE \
10501052
HAVE_STRIDE_SCHED \
10511053
HAVE_STRUCT_TIMESPEC \
1052-
HAVE_NANOTIMESTAMP \
1054+
TIMESTAMP_NANOSEC \
10531055
HAVE_FLOAT_TYPES \
10541056
HAVE_IP6 \
10551057
HAVE___BUILTIN_CLZ \

elements/analysis/toipflowdumps.cc

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ ToIPFlowDumps::Flow::output_binary(StringAccum &sa)
123123
int pos;
124124

125125
buf.u[1] = ntohl(_pkt[pi].timestamp.sec());
126-
#if HAVE_NANOTIMESTAMP
126+
#if TIMESTAMP_NANOSEC
127127
buf.u[2] = ntohl(_pkt[pi].timestamp.nsec());
128128
#else
129129
buf.u[2] = ntohl(_pkt[pi].timestamp.usec());
@@ -198,7 +198,7 @@ ToIPFlowDumps::Flow::output(ErrorHandler *errh)
198198
<< (_ip_p == IP_PROTO_TCP ? 'T' : 'U')
199199
<< "\n!aggregate " << _aggregate << '\n';
200200

201-
#if HAVE_NANOTIMESTAMP
201+
#if TIMESTAMP_NANOSEC
202202
sa << "!data ntimestamp";
203203
#else
204204
sa << "!data timestamp";

elements/userlevel/fakepcap.hh

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ fake_pcap_force_ip(WritablePacket*& p, int dlt)
9393
inline const Timestamp *
9494
fake_bpf_timeval::make_timestamp(const fake_bpf_timeval *tv, Timestamp *ts_storage)
9595
{
96-
#if TIMESTAMP_REP_BIG_ENDIAN && !HAVE_NANOTIMESTAMP
96+
#if TIMESTAMP_REP_BIG_ENDIAN && !TIMESTAMP_NANOSEC
9797
(void) ts_storage;
9898
return reinterpret_cast<const Timestamp*>(tv);
9999
#else

0 commit comments

Comments
 (0)