Windows porting: port hyperscan and chimera tools to windows.

This commit is contained in:
Lu, Qi
2018-05-08 12:05:44 -04:00
committed by Wang, Xiang W
parent bf87f8c003
commit 5a0885d235
34 changed files with 563 additions and 109 deletions

View File

@@ -68,8 +68,9 @@ struct ScanCHContext {
* "echo matches" is off.
*/
static
int onMatch(unsigned int, unsigned long long, unsigned long long, unsigned int,
unsigned int, const ch_capture_t *, void *ctx) {
int HS_CDECL onMatch(unsigned int, unsigned long long, unsigned long long,
unsigned int, unsigned int, const ch_capture_t *,
void *ctx) {
ScanCHContext *sc = static_cast<ScanCHContext *>(ctx);
assert(sc);
sc->result.matches++;
@@ -82,8 +83,9 @@ int onMatch(unsigned int, unsigned long long, unsigned long long, unsigned int,
* matches" is enabled.
*/
static
int onMatchEcho(unsigned int id, unsigned long long, unsigned long long to,
unsigned int, unsigned int, const ch_capture_t *, void *ctx) {
int HS_CDECL onMatchEcho(unsigned int id, unsigned long long,
unsigned long long to, unsigned int, unsigned int,
const ch_capture_t *, void *ctx) {
ScanCHContext *sc = static_cast<ScanCHContext *>(ctx);
assert(sc);
sc->result.matches++;
@@ -166,12 +168,23 @@ void EngineChimera::printStats() const {
}
printf("Signatures: %s\n", compile_stats.signatures.c_str());
printf("Chimera info: %s\n", compile_stats.db_info.c_str());
#ifndef _WIN32
printf("Expression count: %'zu\n", compile_stats.expressionCount);
printf("Bytecode size: %'zu bytes\n", compile_stats.compiledSize);
#else
printf("Expression count: %zu\n", compile_stats.expressionCount);
printf("Bytecode size: %zu bytes\n", compile_stats.compiledSize);
#endif
printf("Database CRC: 0x%x\n", compile_stats.crc32);
#ifndef _WIN32
printf("Scratch size: %'zu bytes\n", compile_stats.scratchSize);
printf("Compile time: %'0.3Lf seconds\n", compile_stats.compileSecs);
printf("Peak heap usage: %'u bytes\n", compile_stats.peakMemorySize);
#else
printf("Scratch size: %zu bytes\n", compile_stats.scratchSize);
printf("Compile time: %0.3Lf seconds\n", compile_stats.compileSecs);
printf("Peak heap usage: %u bytes\n", compile_stats.peakMemorySize);
#endif
}
void EngineChimera::sqlStats(SqlDB &sqldb) const {