Detect L1 cache line size at build time. Fall back to 64 bytes if detection failed.

pull/350/head
Victor Julien 12 years ago
parent 53fe756798
commit 724ad9e8e7

@ -1482,6 +1482,12 @@ AC_INIT(configure.ac)
fi
fi
# get cache line size
AC_PATH_PROG(HAVE_GETCONF_CMD, getconf, "no")
if test "$HAVE_GETCONF_CMD" != "no"; then
CLS=$(getconf LEVEL1_DCACHE_LINESIZE)
AC_DEFINE_UNQUOTED([CLS],[${CLS}],[L1 cache line size])
fi
# get revision
if test -f ./revision; then

@ -40,6 +40,11 @@
#include <config.h>
#endif
#ifndef CLS
#warning "L1 cache line size not detected during build. Assuming 64 bytes."
#define CLS 64
#endif
#if HAVE_STDIO_H
#include <stdio.h>
#endif

@ -696,6 +696,9 @@ void SCPrintBuildInfo(void) {
#ifdef _FORTIFY_SOURCE
printf("compiled with _FORTIFY_SOURCE=%d\n", _FORTIFY_SOURCE);
#endif
#ifdef CLS
printf("L1 cache line size (CLS)=%d\n", CLS);
#endif
printf("compiled with libhtp %s, linked against %s\n", HTP_BASE_VERSION_TEXT, htp_get_version());

Loading…
Cancel
Save