add the make file in Aux, small change for Ubuntu 23.04

This commit is contained in:
Ryan Tang 2024-04-11 19:29:23 -04:00
parent 04a877fc51
commit 15493870cf
4 changed files with 63 additions and 6 deletions

13
Aux/Makefile Normal file
View File

@ -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

44
Aux/netTraffic.py Executable file
View File

@ -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)

View File

@ -7,7 +7,7 @@
#define MIN_VERSION_GROUP 2022122300 #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 TYPE {CH, DIG, LVDS, VGA, GROUP};
enum RW { ReadOnly, WriteOnly, ReadWrite}; enum RW { ReadOnly, WriteOnly, ReadWrite};
@ -30,14 +30,14 @@ class Reg {
type = TYPE::CH; type = TYPE::CH;
isCmd = false; isCmd = false;
value = ""; value = "";
ansType = ANSTYPE::LIST; ansType = ANSTYPE::COMBOX;
answerUnit = ""; answerUnit = "";
answer.clear(); answer.clear();
} }
Reg(std::string para, RW readwrite, Reg(std::string para, RW readwrite,
TYPE type = TYPE::CH, TYPE type = TYPE::CH,
std::vector<std::pair<std::string,std::string>> answer = {}, std::vector<std::pair<std::string,std::string>> answer = {},
ANSTYPE ansType = ANSTYPE::LIST, ANSTYPE ansType = ANSTYPE::COMBOX,
std::string ansUnit = "", std::string ansUnit = "",
bool isCmd = false){ bool isCmd = false){
this->name = para; this->name = para;
@ -51,7 +51,7 @@ class Reg {
} }
~Reg(){}; ~Reg(){};
void SetValue(std::string sv) { this->value = sv;} void SetValue(std::string sv) { value = sv;}
std::string GetValue() const { return value;} std::string GetValue() const { return value;}
RW ReadWrite() const {return readWrite;} RW ReadWrite() const {return readWrite;}
TYPE GetType() const {return type;} TYPE GetType() const {return type;}

View File

@ -3178,7 +3178,7 @@ void DigiSettingsPanel::ReadBoardSetting(int cbIndex){
} }
if( haha == ANSTYPE::FLOAT) sbBdSettingsWrite->setDecimals(3); if( haha == ANSTYPE::FLOAT) sbBdSettingsWrite->setDecimals(3);
//===== combo Box //===== combo Box
if( haha == ANSTYPE::LIST){ if( haha == ANSTYPE::COMBOX){
cbBdAns->setEnabled(true); cbBdAns->setEnabled(true);
cbBdAns->clear(); cbBdAns->clear();
int ansIndex = -1; int ansIndex = -1;
@ -3284,7 +3284,7 @@ void DigiSettingsPanel::ReadChannelSetting(int cbIndex){
sbChSettingsWrite->setDecimals(3); sbChSettingsWrite->setDecimals(3);
} }
if( haha == ANSTYPE::INTEGER) sbBdSettingsWrite->setDecimals(0); if( haha == ANSTYPE::INTEGER) sbBdSettingsWrite->setDecimals(0);
if( haha == ANSTYPE::LIST){ if( haha == ANSTYPE::COMBOX){
cbChSettingsWrite->setEnabled(true); cbChSettingsWrite->setEnabled(true);
cbChSettingsWrite->clear(); cbChSettingsWrite->clear();
int ansIndex = -1; int ansIndex = -1;