From 15493870cffeceae3235f0f5ad19f727181a645d Mon Sep 17 00:00:00 2001 From: "Ryan@SOLARIS_testStation" Date: Thu, 11 Apr 2024 19:29:23 -0400 Subject: [PATCH] add the make file in Aux, small change for Ubuntu 23.04 --- Aux/Makefile | 13 +++++++++++++ Aux/netTraffic.py | 44 +++++++++++++++++++++++++++++++++++++++++++ DigiParameters.h | 8 ++++---- digiSettingsPanel.cpp | 4 ++-- 4 files changed, 63 insertions(+), 6 deletions(-) create mode 100644 Aux/Makefile create mode 100755 Aux/netTraffic.py diff --git a/Aux/Makefile b/Aux/Makefile new file mode 100644 index 0000000..125976e --- /dev/null +++ b/Aux/Makefile @@ -0,0 +1,13 @@ +CC=g++ +CFLAG= -g +ROOTFLAG=`root-config --cflags --glibs` +all: EventBuilder + +EventBuilder: EventBuilder.cpp SolReader.h ../Hit.h + $(CC) $(CFLAG) EventBuilder.cpp -o EventBuilder ${ROOTFLAG} + +test: test.cpp ../ClassDigitizer2Gen.o + $(CC) $(CFLAG) test.cpp ../ClassDigitizer2Gen.o -o test -lcurl -lCAEN_FELib -lX11 + +clean: + -rm EventBuilder \ No newline at end of file diff --git a/Aux/netTraffic.py b/Aux/netTraffic.py new file mode 100755 index 0000000..ceb8453 --- /dev/null +++ b/Aux/netTraffic.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 + +import psutil +import time +from datetime import datetime + +def calculate_speed(interface, interval=1): + # Get the initial number of bytes sent and received + initial_bytes_sent = psutil.net_io_counters(pernic=True)[interface].bytes_sent + initial_bytes_recv = psutil.net_io_counters(pernic=True)[interface].bytes_recv + + # Wait for the specified interval + time.sleep(interval) + + # Get the number of bytes sent and received after the interval + final_bytes_sent = psutil.net_io_counters(pernic=True)[interface].bytes_sent + final_bytes_recv = psutil.net_io_counters(pernic=True)[interface].bytes_recv + + # Calculate the data speed in bytes per second + sent_speed = final_bytes_sent - initial_bytes_sent + recv_speed = final_bytes_recv - initial_bytes_recv + + return sent_speed, recv_speed + +# Define the network interface +interface = 'enp6s0f0' + +print("Monitoring data speed for interface: {}".format(interface)) + +# Continuous monitoring loop +while True: + # Calculate the data speed for the interface + sent_speed, recv_speed = calculate_speed(interface, 6) + + # Convert bytes + sent_speed_mbps = sent_speed / 1024. + recv_speed_mbps = recv_speed / 1024. + + current_time = datetime.now().strftime("%H:%M:%S") + + print("{}| Data speed (sent): {:10f} KiB/s (received): {:10f} KiB/s".format(current_time, sent_speed_mbps,recv_speed_mbps)) + + # Wait for one second before the next iteration + #time.sleep(1) \ No newline at end of file diff --git a/DigiParameters.h b/DigiParameters.h index 1f4b349..8b893c6 100644 --- a/DigiParameters.h +++ b/DigiParameters.h @@ -7,7 +7,7 @@ #define MIN_VERSION_GROUP 2022122300 -enum ANSTYPE {INTEGER, FLOAT, LIST, STR, BYTE, BINARY, NONE}; +enum ANSTYPE {INTEGER, FLOAT, COMBOX, STR, BYTE, BINARY, NONE}; enum TYPE {CH, DIG, LVDS, VGA, GROUP}; enum RW { ReadOnly, WriteOnly, ReadWrite}; @@ -30,14 +30,14 @@ class Reg { type = TYPE::CH; isCmd = false; value = ""; - ansType = ANSTYPE::LIST; + ansType = ANSTYPE::COMBOX; answerUnit = ""; answer.clear(); } Reg(std::string para, RW readwrite, TYPE type = TYPE::CH, std::vector> answer = {}, - ANSTYPE ansType = ANSTYPE::LIST, + ANSTYPE ansType = ANSTYPE::COMBOX, std::string ansUnit = "", bool isCmd = false){ this->name = para; @@ -51,7 +51,7 @@ class Reg { } ~Reg(){}; - void SetValue(std::string sv) { this->value = sv;} + void SetValue(std::string sv) { value = sv;} std::string GetValue() const { return value;} RW ReadWrite() const {return readWrite;} TYPE GetType() const {return type;} diff --git a/digiSettingsPanel.cpp b/digiSettingsPanel.cpp index b853478..70b0aea 100644 --- a/digiSettingsPanel.cpp +++ b/digiSettingsPanel.cpp @@ -3178,7 +3178,7 @@ void DigiSettingsPanel::ReadBoardSetting(int cbIndex){ } if( haha == ANSTYPE::FLOAT) sbBdSettingsWrite->setDecimals(3); //===== combo Box - if( haha == ANSTYPE::LIST){ + if( haha == ANSTYPE::COMBOX){ cbBdAns->setEnabled(true); cbBdAns->clear(); int ansIndex = -1; @@ -3284,7 +3284,7 @@ void DigiSettingsPanel::ReadChannelSetting(int cbIndex){ sbChSettingsWrite->setDecimals(3); } if( haha == ANSTYPE::INTEGER) sbBdSettingsWrite->setDecimals(0); - if( haha == ANSTYPE::LIST){ + if( haha == ANSTYPE::COMBOX){ cbChSettingsWrite->setEnabled(true); cbChSettingsWrite->clear(); int ansIndex = -1;