summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliuxueli <[email protected]>2020-11-06 11:54:38 +0600
committerliuxueli <[email protected]>2020-11-06 11:54:38 +0600
commit7b27b51b53b51a9d45122872be8a09096ccecf4a (patch)
tree047f43a2e742121e3ba233d80933b765c25daacc
parentafba3b1c23773dcbaa364a6b7039fb22085b8f3f (diff)
parentdff4a110436bfbde450aa8bd411fbac767c1d30e (diff)
Merge branch 'master' of https://git.mesalab.cn/MESA_framework/FieldStat2
-rw-r--r--.gitlab-ci.yml2
-rw-r--r--ci/travis.sh4
-rw-r--r--src/MESA_field_stat.cpp22
3 files changed, 19 insertions, 9 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index edd5b6f..b99e5a3 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -68,7 +68,7 @@ develop_build_release:
BUILD_TYPE: RelWithDebInfo
PACKAGE: 1
UPLOAD_RPM: 1
- ASAN_OPTION: ADDRESS
+ ASAN_OPTION: "OFF"
TESTING_VERSION_BUILD: 1
INSTALL_DEPENDENCY_LIBRARY: libasan
PULP3_REPO_NAME: framework-testing-x86_64.el7
diff --git a/ci/travis.sh b/ci/travis.sh
index a103aa1..8179750 100644
--- a/ci/travis.sh
+++ b/ci/travis.sh
@@ -37,6 +37,10 @@ if [ -n "${INSTALL_DEPENDENCY_LIBRARY}" ]; then
yum install -y $INSTALL_DEPENDENCY_LIBRARY
fi
+if [ $ASAN_OPTION ];then
+ source /opt/rh/devtoolset-7/enable
+fi
+
mkdir build || true
cd build
diff --git a/src/MESA_field_stat.cpp b/src/MESA_field_stat.cpp
index d6c0581..1e1d3ea 100644
--- a/src/MESA_field_stat.cpp
+++ b/src/MESA_field_stat.cpp
@@ -23,7 +23,7 @@
#define INIT_STAT_FIELD_NUM 1024
-#define MAX_STAT_COLUMN_NUM 32
+#define MAX_STAT_COLUMN_NUM 64
#define MAX_PATH_LEN 256
#define UDP_PAYLOAD_SIZE 1460
@@ -438,10 +438,7 @@ int FS_set_para(screen_stat_handle_t handle, enum FS_option type,const void* va
{
return -1;
}
- if(type!=OUTPUT_DEVICE)
- {
- int_val=*(const int*)value;
- }
+
switch(type)
{
case OUTPUT_DEVICE:
@@ -449,7 +446,8 @@ int FS_set_para(screen_stat_handle_t handle, enum FS_option type,const void* va
memcpy(_handle->appoint_output_file,value,size);
break;
case PRINT_MODE:
- if(size!=4||(int_val!=1&&int_val!=2))
+ int_val = *(const int *)value;
+ if (size != 4 || (int_val != 1 && int_val != 2))
{
return -1;
}
@@ -464,6 +462,7 @@ int FS_set_para(screen_stat_handle_t handle, enum FS_option type,const void* va
}
break;
case STAT_CYCLE:
+ int_val = *(const int *)value;
if(size!=4||(int_val==0))
{
return -1;
@@ -471,6 +470,7 @@ int FS_set_para(screen_stat_handle_t handle, enum FS_option type,const void* va
_handle->stat_cycle=int_val;
break;
case PRINT_TRIGGER:
+ int_val = *(const int *)value;
if(size!=4||(int_val!=0&&int_val!=1))
{
return -1;
@@ -478,6 +478,7 @@ int FS_set_para(screen_stat_handle_t handle, enum FS_option type,const void* va
_handle->screen_print_trigger=int_val;
break;
case CREATE_THREAD:
+ int_val = *(const int *)value;
if(size!=4||(int_val!=0&&int_val!=1))
{
return -1;
@@ -485,6 +486,7 @@ int FS_set_para(screen_stat_handle_t handle, enum FS_option type,const void* va
_handle->create_thread=int_val;
break;
case ID_INVISBLE:
+ int_val = *(const int *)value;
if(int_val<0||int_val>=_handle->display_cnt)
{
return -1;
@@ -492,6 +494,7 @@ int FS_set_para(screen_stat_handle_t handle, enum FS_option type,const void* va
_handle->display[int_val]->is_invisible=1;
break;
case NOT_SEND_METRIC_TO_SERVER:
+ int_val = *(const int *)value;
if(int_val<0||int_val>=_handle->display_cnt)
{
return -1;
@@ -499,6 +502,7 @@ int FS_set_para(screen_stat_handle_t handle, enum FS_option type,const void* va
_handle->display[int_val]->not_send_to_server=1;
break;
case FLUSH_BY_DATE:
+ int_val = *(const int *)value;
if(int_val==1)
{
_handle->flush_by_date=1;
@@ -539,6 +543,7 @@ int FS_set_para(screen_stat_handle_t handle, enum FS_option type,const void* va
}
break;
case STATS_FORMAT:
+ int_val = *(const int *)value;
if(size!=4||(int_val!=FS_OUTPUT_STATSD&&int_val!=FS_OUTPUT_INFLUX_LINE))
{
return -1;
@@ -562,6 +567,7 @@ int FS_set_para(screen_stat_handle_t handle, enum FS_option type,const void* va
_handle->histogram_bin_num=parse_histogram_bin_format((const char*)value, &_handle->histogram_bins);
assert(_handle->histogram_bin_num>0);
case METRIS_FORMAT:
+ int_val = *(const int *)value;
if(size!=4||(int_val!=FS_METRIS_OUTPUT_DEFAULT&&int_val!=FS_METRIS_OUTPUT_JSON))
{
return -1;
@@ -752,7 +758,7 @@ int FS_register_histogram(screen_stat_handle_t handle, enum field_calc_algo calc
{
struct FS_space_t* _handle=(struct FS_space_t*)handle;
struct display_manifest_t * choosen=NULL;
- int id=0, ret=0;
+ int id=0;
if(!is_valid_fs_name(name))
{
return -1;
@@ -776,7 +782,7 @@ int FS_register_histogram(screen_stat_handle_t handle, enum field_calc_algo calc
choosen->histogram.lowest_trackable_value=(int64_t)lowest_trackable_value;
choosen->histogram.significant_figures=significant_figures;
- ret=hdr_init((int64_t)lowest_trackable_value, (int64_t)highest_trackable_value, significant_figures, &(choosen->histogram.changing));
+ int ret=hdr_init((int64_t)lowest_trackable_value, (int64_t)highest_trackable_value, significant_figures, &(choosen->histogram.changing));
assert(ret==0);
ret=hdr_init((int64_t)lowest_trackable_value, (int64_t)highest_trackable_value, significant_figures, &(choosen->histogram.accumulated));
assert(ret==0);