From b39da83c4c942a0fb301471a0bc127ae3c32bce2 Mon Sep 17 00:00:00 2001 From: vlad shkapenyuk Date: Fri, 13 Sep 2019 10:38:52 -0400 Subject: [PATCH] Change VES version to 7. Added additional UDAFs Signed-off-by: vlad shkapenyuk Change-Id: Ib9e6fb0644901db08f9d593f1734507b9ca10c6d --- cfg/external_fcns.def | 6 +++++ include/hfta/hfta.h | 4 +++- include/hfta/hfta_udaf.h | 20 ++++++++++++++++ include/lfta/rts_external.h | 6 +++++ src/ftacmp/translate_fta.cc | 16 +++++++++---- src/lib/gscphftaaux/hfta_udaf.cc | 51 ++++++++++++++++++++++++++++++++++++++++ src/tools/gsprintconsole_ves.c | 2 +- 7 files changed, 98 insertions(+), 7 deletions(-) diff --git a/cfg/external_fcns.def b/cfg/external_fcns.def index 43f3839..015e3f2 100644 --- a/cfg/external_fcns.def +++ b/cfg/external_fcns.def @@ -71,6 +71,12 @@ uint FUN [LFTA_LEGAL, COST EXPENSIVE] ullong FUN [LFTA_LEGAL,COST FREE]ULLONG(uint); ullong FUN [LFTA_LEGAL,COST FREE]ULLONG(int); +/////////////////////////////////////////////////////////// +// Numeric functions +/////////////////////////////////////////////////////////// + + float FUN [LFTA_LEGAL, COST LOW] sqrt(float); + /////////////////////////////////////////////////////////// // Convert an IPv4 address diff --git a/include/hfta/hfta.h b/include/hfta/hfta.h index 535b375..b95f77d 100644 --- a/include/hfta/hfta.h +++ b/include/hfta/hfta.h @@ -21,6 +21,7 @@ Copyright 2014 AT&T Intellectual Property #include "base_operator.h" #include #include +#include #include "rdtsc.h" using namespace std; @@ -34,7 +35,8 @@ using namespace std; #define LEQ(x,y) ((x)<=(y)) // Cast away temporality #define non_temporal(x)(x) - +// Access math libraries +#define sqrt(x) sqrt(x) extern "C" { diff --git a/include/hfta/hfta_udaf.h b/include/hfta/hfta_udaf.h index d97e0dd..67dd794 100644 --- a/include/hfta/hfta_udaf.h +++ b/include/hfta/hfta_udaf.h @@ -94,6 +94,26 @@ void FIRST_STR_hfta_HFTA_AGGR_OUTPUT_(vstring* res, vstring* scratch); void FIRST_STR_hfta_HFTA_AGGR_DESTROY_(vstring* scratch); // last aggregate +// hfta only +void LAST_HFTA_AGGR_INIT_(gs_uint32_t* scratch); +void LAST_HFTA_AGGR_REINIT_(gs_uint32_t* scratch); +void LAST_HFTA_AGGR_UPDATE_(gs_uint32_t* scratch, gs_uint32_t val); +void LAST_HFTA_AGGR_OUTPUT_(gs_uint32_t* res, gs_uint32_t* scratch); +void LAST_HFTA_AGGR_DESTROY_(gs_uint32_t* scratch); + +void LAST_ULL_HFTA_AGGR_INIT_(gs_uint64_t* scratch); +void LAST_ULL_HFTA_AGGR_REINIT_(gs_uint64_t* scratch); +void LAST_ULL_HFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val); +void LAST_ULL_HFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch); +void LAST_ULL_HFTA_AGGR_DESTROY_(gs_uint64_t* scratch); + +void LAST_STR_HFTA_AGGR_INIT_(vstring* scratch); +void LAST_STR_HFTA_AGGR_REINIT_(vstring* scratch); +void LAST_STR_HFTA_AGGR_UPDATE_(vstring* scratch, vstring* val); +void LAST_STR_HFTA_AGGR_OUTPUT_(vstring* res, vstring* scratch); +void LAST_STR_HFTA_AGGR_DESTROY_(vstring* scratch); + +// hfta/lfta split void LAST_hfta_HFTA_AGGR_INIT_(gs_uint32_t* scratch); void LAST_hfta_HFTA_AGGR_REINIT_(gs_uint32_t* scratch); void LAST_hfta_HFTA_AGGR_UPDATE_(gs_uint32_t* scratch, gs_uint32_t val); diff --git a/include/lfta/rts_external.h b/include/lfta/rts_external.h index 1f16682..5e0f197 100644 --- a/include/lfta/rts_external.h +++ b/include/lfta/rts_external.h @@ -17,6 +17,8 @@ ------------------------------------------- */ #include +#include + #include "gsconfig.h" #include "gstypes.h" @@ -91,6 +93,10 @@ gs_retval_t str_constructor(struct gs_string *s, gs_sp_t l); // Cast away temporality #define non_temporal(x)(x) +// Access math libraries +#define sqrt(x) sqrt(x) + + gs_uint32_t str_match_offset( gs_uint32_t offset, struct gs_string * s1, struct gs_string * s2); diff --git a/src/ftacmp/translate_fta.cc b/src/ftacmp/translate_fta.cc index 625cbac..4a1263f 100644 --- a/src/ftacmp/translate_fta.cc +++ b/src/ftacmp/translate_fta.cc @@ -2520,11 +2520,17 @@ for(ssi_el=extra_external_libs.begin();ssi_el!=extra_external_libs.end();++ssi_e fprintf(stderr,"interface %s, LFTA %d, snap length is %d\n",liface.c_str(),mi,snap_lengths[mi]); - lfta_val[lmach] += "\tfta_register(\""+query_names[mi]+"\", " + (lfta_reuse_options[mi]?"1":"0") + ", "; - if(interface_names[mi]=="") - lfta_val[lmach]+="DEFAULTDEV"; - else - lfta_val[lmach]+='"'+interface_names[mi]+'"'; + string this_iface = "DEFAULTDEV"; + if(interface_names[mi]!="") + this_iface = '"'+interface_names[mi]+'"'; + lfta_val[lmach] += "\tif(!strcmp(device,"+this_iface+"))\n"; + lfta_val[lmach] += "\t\tfta_register(\""+query_names[mi]+"\", " + (lfta_reuse_options[mi]?"1":"0") + ", "; +// if(interface_names[mi]=="") +// lfta_val[lmach]+="DEFAULTDEV"; +// else +// lfta_val[lmach]+='"'+interface_names[mi]+'"'; + lfta_val[lmach] += this_iface; + lfta_val[lmach] += ", "+generate_alloc_name(query_names[mi]) +"\n#ifndef LFTA_IN_NIC\n\t,"+generate_schema_string_name(query_names[mi]) diff --git a/src/lib/gscphftaaux/hfta_udaf.cc b/src/lib/gscphftaaux/hfta_udaf.cc index fb0f1d5..ad26871 100644 --- a/src/lib/gscphftaaux/hfta_udaf.cc +++ b/src/lib/gscphftaaux/hfta_udaf.cc @@ -331,6 +331,57 @@ void FIRST_STR_hfta_HFTA_AGGR_DESTROY_(vstring* scratch) { } ///////////////////////////////////////////////////////// // LAST aggregate +// hfta only + +void LAST_HFTA_AGGR_INIT_(gs_uint32_t* scratch) { } + +void LAST_HFTA_AGGR_REINIT_(gs_uint32_t* scratch) { } + +void LAST_HFTA_AGGR_UPDATE_(gs_uint32_t* scratch, gs_uint32_t val) { + *scratch = val; +} + +void LAST_HFTA_AGGR_OUTPUT_(gs_uint32_t* res, gs_uint32_t* scratch) { + *res = *scratch; +} + +void LAST_HFTA_AGGR_DESTROY_(gs_uint32_t* scratch) { } + +void LAST_ULLHFTA_AGGR_INIT_(gs_uint64_t* scratch) { } + +void LAST_ULL_HFTA_AGGR_REINIT_(gs_uint64_t* scratch) { } + +void LAST_ULL_HFTA_AGGR_UPDATE_(gs_uint64_t* scratch, gs_uint64_t val) { + *scratch = val; +} + +void LAST_ULL_HFTA_AGGR_OUTPUT_(gs_uint64_t* res, gs_uint64_t* scratch) { + *res = *scratch; +} + +void LAST_ULL_HFTA_AGGR_DESTROY_(gs_uint64_t* scratch) { } + + +void LAST_STR_HFTA_AGGR_INIT_(vstring* scratch) { + scratch->offset= 0; +} + +void LAST_STR_HFTA_AGGR_REINIT_(vstring* scratch) { } + +void LAST_STR_HFTA_AGGR_UPDATE_(vstring* scratch, vstring* val) { + scratch->length = val->length; + scratch->offset = val->offset; + scratch->reserved = SHALLOW_COPY; +} + +void LAST_STR_HFTA_AGGR_OUTPUT_(vstring* res, vstring* scratch) { + *res = *scratch; +} + +void LAST_STR_HFTA_AGGR_DESTROY_(vstring* scratch) { } + +// hfta/lfta split + void LAST_hfta_HFTA_AGGR_INIT_(gs_uint32_t* scratch) { } void LAST_hfta_HFTA_AGGR_REINIT_(gs_uint32_t* scratch) { } diff --git a/src/tools/gsprintconsole_ves.c b/src/tools/gsprintconsole_ves.c index 9208316..30ddab8 100644 --- a/src/tools/gsprintconsole_ves.c +++ b/src/tools/gsprintconsole_ves.c @@ -173,7 +173,7 @@ int main(int argc, char* argv[]) { gs_sp_t curl_auth = NULL; gs_uint32_t http_code; - gs_uint32_t ves_version=5; + gs_uint32_t ves_version=7; gs_uint32_t tlimit = 0; // time limit in seconds -- 2.16.6