clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -O3 -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name nodedump.cc -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=cplusplus -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/data/b2soft/buildbot/development/build -fcoverage-compilation-dir=/data/b2soft/buildbot/development/build -resource-dir /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/lib/clang/21 -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/c++ -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/c++/x86_64-redhat-linux -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/c++/backward -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/include -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/python3.12 -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/include/CLHEP -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/Geant4 -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/include/root -isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/include/belle_legacy -I include/ -D _PACKAGE_="daq" -D G4UI_USE_TCSH -D RaveDllExport= -D HAS_SQLITE -D HAS_CALLGRIND -I include -I /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/include/libxml2 -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/bin/../lib64/gcc/x86_64-redhat-linux/15.2.0/../../../../include/c++ -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/bin/../lib64/gcc/x86_64-redhat-linux/15.2.0/../../../../include/c++/x86_64-redhat-linux -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/bin/../lib64/gcc/x86_64-redhat-linux/15.2.0/../../../../include/c++/backward -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/lib/clang/21/include -internal-isystem /usr/local/include -internal-isystem /cvmfs/belle.cern.ch/el9/externals/v02-04-00/Linux_x86_64/common/bin/../lib64/gcc/x86_64-redhat-linux/15.2.0/../../../../x86_64-redhat-linux/include -internal-externc-isystem /include -internal-externc-isystem /usr/include -Wno-missing-braces -Wno-unused-command-line-argument -std=c++20 -fdeprecated-macro -ferror-limit 19 -fgnuc-version=4.2.1 -fno-implicit-modules -fskip-odr-check-in-gmf -fcxx-exceptions -fexceptions -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /scan_build/2026-05-31-004316-385593-1 -x c++ daq/rfarm/manager/tools/nodedump.cc
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | #include <stdio.h> |
| 12 | #include <stdlib.h> |
| 13 | #include <unistd.h> |
| 14 | #include <string.h> |
| 15 | |
| 16 | #include "daq/rfarm/manager/RFConf.h" |
| 17 | #include "daq/rfarm/manager/RFSharedMem.h" |
| 18 | #include "daq/rfarm/manager/RFFlowStat.h" |
| 19 | |
| 20 | using namespace std; |
| 21 | using namespace Belle2; |
| 22 | |
| 23 | int main(int argc, char** argv) |
| 24 | { |
| 25 | |
| 26 | if (argc < 2) { |
| |
| |
| 27 | printf("Usage : nodedump unitname nodename\n"); |
| 28 | return -1; |
| 29 | } |
| 30 | |
| 31 | char host[256]; |
| 32 | gethostname(host, sizeof(host)); |
| 33 | |
| 34 | char* confdir = getenv("RFARM_CONFDIR"); |
| 3 | | Assuming the environment variable does not exist | |
|
| 4 | | 'confdir' initialized here | |
|
| 35 | string confpath = string(confdir) + "/" + string(argv[1]) + ".conf"; |
| 5 | | The parameter must not be null |
|
| 36 | |
| 37 | RFConf conf(confpath.c_str()); |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | char nodename[512]; |
| 43 | int nid = 0; |
| 44 | int idlist[256] = {}; |
| 45 | char item[256][7]; |
| 46 | |
| 47 | if (argc >= 3) { |
| 48 | if (strstr(argv[2], "dist") != NULL) { |
| 49 | strcpy(nodename, "distributor"); |
| 50 | int nnodes = conf.getconfi("processor", "nnodes"); |
| 51 | idlist[0] = RF_INPUT_ID; |
| 52 | strcpy(item[0], "IN "); |
| 53 | for (int i = 0; i < nnodes; i++) { |
| 54 | idlist[i + 1] = i; |
| 55 | sprintf(item[i + 1], "OUT%2.2d ", i); |
| 56 | } |
| 57 | nid = nnodes + 1; |
| 58 | } else if (strstr(argv[2], "col") != NULL) { |
| 59 | strcpy(nodename, "collector"); |
| 60 | int nnodes = conf.getconfi("processor", "nnodes"); |
| 61 | for (int i = 0; i < nnodes; i++) { |
| 62 | idlist[i] = i; |
| 63 | sprintf(item[i], "IN%2.2d ", i); |
| 64 | } |
| 65 | idlist[nnodes] = RF_OUTPUT_ID; |
| 66 | strcpy(item[nnodes], "OUT "); |
| 67 | nid = nnodes + 1; |
| 68 | } else if (strstr(argv[2], "roi") != NULL) { |
| 69 | strcpy(nodename, "roisender"); |
| 70 | idlist[0] = RF_ROI_ID; |
| 71 | strcpy(item[0], "OUT "); |
| 72 | nid = 1; |
| 73 | } |
| 74 | } else { |
| 75 | #ifdef DESY |
| 76 | |
| 77 | strcpy(nodename, "evp_"); |
| 78 | char hostnamebuf[256]; |
| 79 | gethostname(hostnamebuf, sizeof(hostnamebuf)); |
| 80 | strcat(&nodename[4], &hostnamebuf[6]); |
| 81 | int lend = strlen(nodename); |
| 82 | nodename[lend + 1] = (char)0; |
| 83 | nodename[lend] = nodename[lend - 1]; |
| 84 | strncpy(&nodename[lend - 1], "0", 1); |
| 85 | |
| 86 | #else |
| 87 | sprintf(nodename, "evp_%s", host); |
| 88 | #endif |
| 89 | idlist[0] = 0; |
| 90 | strcpy(item[0], "IN "); |
| 91 | idlist[1] = 1; |
| 92 | strcpy(item[1], "OUT "); |
| 93 | nid = 2; |
| 94 | } |
| 95 | string shmname = string(conf.getconf("system", "unitname")) + ":" + |
| 96 | string(nodename); |
| 97 | RFFlowStat flow((char*)shmname.c_str()); |
| 98 | |
| 99 | printf("nodename = %s, nid = %d\n", nodename, nid); |
| 100 | printf("id range : %d to %d\n", idlist[0], idlist[nid - 1]); |
| 101 | |
| 102 | |
| 103 | printf(" At : Nevent Nqueue Flow(MB/s) Size(KB) Rate(Hz)\n"); |
| 104 | for (int i = 0; i < nid; i++) { |
| 105 | RfShm_Cell& cell = flow.getinfo(idlist[i]); |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | printf("%s : %10d %10d %10.2f %10.2f %10.2f\n", |
| 111 | item[i], |
| 112 | cell.nevent, cell.nqueue, cell.flowrate, cell.avesize, |
| 113 | cell.evtrate); |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |