review fixes
This commit is contained in:
@@ -523,7 +523,7 @@ int process_command(char *buf, int iteration)
|
|||||||
int rt;
|
int rt;
|
||||||
memset(modulename,0,sizeof(modulename));
|
memset(modulename,0,sizeof(modulename));
|
||||||
memset(cmd,0,sizeof(cmd));
|
memset(cmd,0,sizeof(cmd));
|
||||||
extern char **environ;
|
|
||||||
|
|
||||||
if (strncasecmp(buf,"ex",2) == 0)
|
if (strncasecmp(buf,"ex",2) == 0)
|
||||||
return CMDSTATUS_EXIT;
|
return CMDSTATUS_EXIT;
|
||||||
@@ -953,7 +953,8 @@ int telnetsrv_checkbuildver(char *mainexec_buildversion, char **shlib_buildvers
|
|||||||
}
|
}
|
||||||
|
|
||||||
int telnetsrv_getfarray(loader_shlibfunc_t **farray) {
|
int telnetsrv_getfarray(loader_shlibfunc_t **farray) {
|
||||||
*farray = malloc(sizeof(loader_shlibfunc_t) * 3);
|
int const num_func_tln_srv = 3;
|
||||||
|
*farray = malloc(sizeof(loader_shlibfunc_t) * num_func_tln_srv);
|
||||||
(*farray)[0].fname=TELNET_ADDCMD_FNAME;
|
(*farray)[0].fname=TELNET_ADDCMD_FNAME;
|
||||||
(*farray)[0].fptr=(int (*)(void) )add_telnetcmd;
|
(*farray)[0].fptr=(int (*)(void) )add_telnetcmd;
|
||||||
(*farray)[1].fname=TELNET_POLLCMDQ_FNAME;
|
(*farray)[1].fname=TELNET_POLLCMDQ_FNAME;
|
||||||
|
|||||||
@@ -194,58 +194,60 @@ int nullprnt(char *fmt, ...)
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void proccmd_get_threaddata(char *buf, int debug, telnet_printfunc_t fprnt, webdatadef_t *tdata)
|
void proccmd_get_threaddata(char *buf, int debug, telnet_printfunc_t fprnt, webdatadef_t *tdata)
|
||||||
{
|
{
|
||||||
char aname[256];
|
char aname[256];
|
||||||
|
|
||||||
DIR *proc_dir;
|
DIR *proc_dir;
|
||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
telnet_printfunc_t prnt = (fprnt != NULL) ? fprnt : (telnet_printfunc_t)nullprnt;
|
telnet_printfunc_t prnt = (fprnt != NULL) ? fprnt : (telnet_printfunc_t)nullprnt;
|
||||||
if (tdata != NULL) {
|
if (tdata != NULL) {
|
||||||
tdata->numcols = 7;
|
tdata->numcols = 7;
|
||||||
snprintf(tdata->columns[0].coltitle, sizeof(tdata->columns[0].coltitle), "thread id");
|
snprintf(tdata->columns[0].coltitle, sizeof(tdata->columns[0].coltitle), "thread id");
|
||||||
tdata->columns[0].coltype = TELNET_VARTYPE_STRING | TELNET_CHECKVAL_RDONLY | TELNET_VAR_NEEDFREE;
|
tdata->columns[0].coltype = TELNET_VARTYPE_STRING | TELNET_CHECKVAL_RDONLY | TELNET_VAR_NEEDFREE;
|
||||||
snprintf(tdata->columns[1].coltitle, sizeof(tdata->columns[1].coltitle), "thread name");
|
snprintf(tdata->columns[1].coltitle, sizeof(tdata->columns[1].coltitle), "thread name");
|
||||||
tdata->columns[1].coltype = TELNET_VARTYPE_STRING | TELNET_CHECKVAL_RDONLY | TELNET_VAR_NEEDFREE;
|
tdata->columns[1].coltype = TELNET_VARTYPE_STRING | TELNET_CHECKVAL_RDONLY | TELNET_VAR_NEEDFREE;
|
||||||
snprintf(tdata->columns[2].coltitle, sizeof(tdata->columns[2].coltitle), "priority");
|
snprintf(tdata->columns[2].coltitle, sizeof(tdata->columns[2].coltitle), "priority");
|
||||||
tdata->columns[2].coltype = TELNET_VARTYPE_STRING | TELNET_CHECKVAL_RDONLY | TELNET_VAR_NEEDFREE;
|
tdata->columns[2].coltype = TELNET_VARTYPE_STRING | TELNET_CHECKVAL_RDONLY | TELNET_VAR_NEEDFREE;
|
||||||
snprintf(tdata->columns[3].coltitle, sizeof(tdata->columns[3].coltitle), "nice");
|
snprintf(tdata->columns[3].coltitle, sizeof(tdata->columns[3].coltitle), "nice");
|
||||||
tdata->columns[3].coltype = TELNET_VARTYPE_STRING | TELNET_CHECKVAL_RDONLY | TELNET_VAR_NEEDFREE;
|
tdata->columns[3].coltype = TELNET_VARTYPE_STRING | TELNET_CHECKVAL_RDONLY | TELNET_VAR_NEEDFREE;
|
||||||
snprintf(tdata->columns[4].coltitle, sizeof(tdata->columns[4].coltitle), "core");
|
snprintf(tdata->columns[4].coltitle, sizeof(tdata->columns[4].coltitle), "core");
|
||||||
tdata->columns[4].coltype = TELNET_VARTYPE_STRING | TELNET_VAR_NEEDFREE;
|
tdata->columns[4].coltype = TELNET_VARTYPE_STRING | TELNET_VAR_NEEDFREE;
|
||||||
snprintf(tdata->columns[5].coltitle, sizeof(tdata->columns[5].coltitle), "sched policy");
|
snprintf(tdata->columns[5].coltitle, sizeof(tdata->columns[5].coltitle), "sched policy");
|
||||||
tdata->columns[5].coltype = TELNET_VARTYPE_STRING | TELNET_CHECKVAL_RDONLY | TELNET_VAR_NEEDFREE;
|
tdata->columns[5].coltype = TELNET_VARTYPE_STRING | TELNET_CHECKVAL_RDONLY | TELNET_VAR_NEEDFREE;
|
||||||
snprintf(tdata->columns[5].coltitle, sizeof(tdata->columns[5].coltitle), "sched policy");
|
snprintf(tdata->columns[5].coltitle, sizeof(tdata->columns[5].coltitle), "sched policy");
|
||||||
tdata->columns[6].coltype = TELNET_VARTYPE_STRING | TELNET_VAR_NEEDFREE;
|
tdata->columns[6].coltype = TELNET_VARTYPE_STRING | TELNET_VAR_NEEDFREE;
|
||||||
snprintf(tdata->columns[6].coltitle, sizeof(tdata->columns[6].coltitle), "oai priority");
|
snprintf(tdata->columns[6].coltitle, sizeof(tdata->columns[6].coltitle), "oai priority");
|
||||||
tdata->numlines = 0;
|
tdata->numlines = 0;
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int eax = 11, ebx = 0, ecx = 1, edx = 0;
|
|
||||||
|
|
||||||
asm volatile("cpuid" : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) : "0"(eax), "2"(ecx) :);
|
|
||||||
|
|
||||||
prnt("System has %d cores %d threads %d Actual threads", eax, ebx, edx);
|
|
||||||
|
|
||||||
prnt("\n id name state USRmod KRNmod prio nice vsize proc pol \n\n");
|
|
||||||
snprintf(aname, sizeof(aname), "/proc/%d/stat", getpid());
|
|
||||||
read_statfile(aname, debug, prnt, NULL);
|
|
||||||
prnt("\n");
|
|
||||||
snprintf(aname, sizeof(aname), "/proc/%d/task", getpid());
|
|
||||||
proc_dir = opendir(aname);
|
|
||||||
if (proc_dir == NULL) {
|
|
||||||
prnt("Error: Couldn't open %s %i %s\n", aname, errno, strerror(errno));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((entry = readdir(proc_dir)) != NULL) {
|
|
||||||
if (entry->d_name[0] != '.') {
|
|
||||||
snprintf(aname, sizeof(aname), "/proc/%d/task/%.*s/stat", getpid(), (int)(sizeof(aname) - 24), entry->d_name);
|
|
||||||
read_statfile(aname, debug, prnt, tdata);
|
|
||||||
}
|
}
|
||||||
} /* while entry != NULL */
|
|
||||||
closedir(proc_dir);
|
unsigned int eax = 11, ebx = 0, ecx = 1, edx = 0;
|
||||||
} /* print_threads */
|
|
||||||
|
asm volatile("cpuid" : "=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx) : "0"(eax), "2"(ecx) :);
|
||||||
|
|
||||||
|
prnt("System has %d cores %d threads %d Actual threads", eax, ebx, edx);
|
||||||
|
|
||||||
|
prnt("\n id name state USRmod KRNmod prio nice vsize proc pol \n\n");
|
||||||
|
snprintf(aname, sizeof(aname), "/proc/%d/stat", getpid());
|
||||||
|
read_statfile(aname, debug, prnt, NULL);
|
||||||
|
prnt("\n");
|
||||||
|
snprintf(aname, sizeof(aname), "/proc/%d/task", getpid());
|
||||||
|
proc_dir = opendir(aname);
|
||||||
|
if (proc_dir == NULL) {
|
||||||
|
prnt("Error: Couldn't open %s %i %s\n", aname, errno, strerror(errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
while ((entry = readdir(proc_dir)) != NULL) {
|
||||||
|
if (entry->d_name[0] != '.') {
|
||||||
|
snprintf(aname, sizeof(aname), "/proc/%d/task/%.*s/stat", getpid(), (int)(sizeof(aname) - 24), entry->d_name);
|
||||||
|
read_statfile(aname, debug, prnt, tdata);
|
||||||
|
}
|
||||||
|
} /* while entry != NULL */
|
||||||
|
closedir(proc_dir);
|
||||||
|
} /* proccmd_get_threaddata */
|
||||||
|
|
||||||
void print_threads(char *buf, int debug, telnet_printfunc_t prnt)
|
void print_threads(char *buf, int debug, telnet_printfunc_t prnt)
|
||||||
{
|
{
|
||||||
proccmd_get_threaddata(buf, debug, prnt, NULL);
|
proccmd_get_threaddata(buf, debug, prnt, NULL);
|
||||||
|
|||||||
@@ -26,18 +26,21 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "executables/softmodem-common.h"
|
#include "executables/softmodem-common.h"
|
||||||
#include "executables/nr-softmodem-common.h"
|
#include "executables/nr-softmodem-common.h"
|
||||||
#ifndef WEBSRVSCOPE
|
#ifdef WEBSRVSCOPE
|
||||||
#include <forms.h>
|
|
||||||
#define STATICFORXSCOPE static
|
|
||||||
static const int scope_enb_num_ue = 1;
|
|
||||||
#else
|
|
||||||
#include <ulfius.h>
|
#include <ulfius.h>
|
||||||
#include "common/utils/websrv/websrv.h"
|
#include "common/utils/websrv/websrv.h"
|
||||||
#include "common/utils/websrv/websrv_noforms.h"
|
#include "common/utils/websrv/websrv_noforms.h"
|
||||||
|
/* STATICFORXSCOPE will be used to make function being called from websrv code non static when we compile
|
||||||
|
* with WEBSRVSCOPE mocro defined, but static when we compile for Xforms scope
|
||||||
|
*/
|
||||||
#define STATICFORXSCOPE
|
#define STATICFORXSCOPE
|
||||||
#define fl_add_canvas websrv_fl_add_canvas
|
#define fl_add_canvas websrv_fl_add_canvas
|
||||||
#define fl_add_xyplot websrv_fl_add_xyplot
|
#define fl_add_xyplot websrv_fl_add_xyplot
|
||||||
#define fl_get_xyplot_data_pointer websrv_fl_get_xyplot_data_pointer
|
#define fl_get_xyplot_data_pointer websrv_fl_get_xyplot_data_pointer
|
||||||
|
#else
|
||||||
|
#include <forms.h>
|
||||||
|
#define STATICFORXSCOPE static
|
||||||
|
static const int scope_enb_num_ue = 1;
|
||||||
#endif
|
#endif
|
||||||
#include "nr_phy_scope.h"
|
#include "nr_phy_scope.h"
|
||||||
#include "phy_scope.h"
|
#include "phy_scope.h"
|
||||||
@@ -379,7 +382,12 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WEBSRVSCOPE
|
#ifdef WEBSRVSCOPE
|
||||||
|
for (int i = 0; i < sizeof(water_colors) / sizeof(FL_COLOR); i++) {
|
||||||
|
msgp[i]->header.msgseg = graph->iteration % displayPart;
|
||||||
|
websrv_scope_senddata(msgp[i]->data_xy[0], 2, msgp[i]);
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (graph->initDone==false) {
|
if (graph->initDone==false) {
|
||||||
for ( int i=0; i < graph->waterFallh; i++ )
|
for ( int i=0; i < graph->waterFallh; i++ )
|
||||||
for ( int j = 0 ; j < graph->w ; j++ )
|
for ( int j = 0 ; j < graph->w ; j++ )
|
||||||
@@ -393,23 +401,18 @@ static void genericWaterFall (OAIgraph_t *graph, scopeSample_t *values, const in
|
|||||||
}
|
}
|
||||||
|
|
||||||
fl_set_object_label_f(graph->text, "%s, avg I/Q pow: %4.1f", label, 0/*sqrt(avg)*/);
|
fl_set_object_label_f(graph->text, "%s, avg I/Q pow: %4.1f", label, 0/*sqrt(avg)*/);
|
||||||
#else
|
|
||||||
for (int i = 0; i < sizeof(water_colors) / sizeof(FL_COLOR); i++) {
|
|
||||||
msgp[i]->header.msgseg = graph->iteration % displayPart;
|
|
||||||
websrv_scope_senddata(msgp[i]->data_xy[0], 2, msgp[i]);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
graph->iteration++;
|
graph->iteration++;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) {
|
static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const scopeSample_t **data, const int len) {
|
||||||
#ifndef WEBSRVSCOPE
|
#ifdef WEBSRVSCOPE
|
||||||
float *values, *time;
|
|
||||||
oai_xygraph_getbuff(graph, &time, &values, len, 0);
|
|
||||||
#else
|
|
||||||
websrv_scopedata_msg_t *msg = NULL;
|
websrv_scopedata_msg_t *msg = NULL;
|
||||||
websrv_nf_getdata(graph->graph, 0, &msg);
|
websrv_nf_getdata(graph->graph, 0, &msg);
|
||||||
float *values = (float *)msg->data_xy;
|
float *values = (float *)msg->data_xy;
|
||||||
|
#else
|
||||||
|
float *values, *time;
|
||||||
|
oai_xygraph_getbuff(graph, &time, &values, len, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (int ant=0; ant<nb_ant; ant++) {
|
for (int ant=0; ant<nb_ant; ant++) {
|
||||||
@@ -417,15 +420,15 @@ static void genericPowerPerAntena(OAIgraph_t *graph, const int nb_ant, const sc
|
|||||||
for (int i=0; i<len; i++) {
|
for (int i=0; i<len; i++) {
|
||||||
values[i] = SquaredNorm(data[ant][i]);
|
values[i] = SquaredNorm(data[ant][i]);
|
||||||
}
|
}
|
||||||
#ifndef WEBSRVSCOPE
|
#ifdef WEBSRVSCOPE
|
||||||
oai_xygraph(graph,time,values, len, ant, 10);
|
|
||||||
#else
|
|
||||||
msg->header.msgtype = SCOPEMSG_TYPE_DATA;
|
msg->header.msgtype = SCOPEMSG_TYPE_DATA;
|
||||||
msg->header.chartid = graph->chartid;
|
msg->header.chartid = graph->chartid;
|
||||||
msg->header.datasetid = graph->datasetid;
|
msg->header.datasetid = graph->datasetid;
|
||||||
msg->header.msgseg = 0;
|
msg->header.msgseg = 0;
|
||||||
msg->header.update = (ant == (nb_ant - 1)) ? 1 : 0;
|
msg->header.update = (ant == (nb_ant - 1)) ? 1 : 0;
|
||||||
websrv_scope_senddata(len, 4, msg);
|
websrv_scope_senddata(len, 4, msg);
|
||||||
|
#else
|
||||||
|
oai_xygraph(graph,time,values, len, ant, 10);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -454,13 +457,13 @@ static void timeSignal (OAIgraph_t *graph, PHY_VARS_gNB *phy_vars_gnb, RU_t *phy
|
|||||||
|
|
||||||
static void timeResponse (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) {
|
static void timeResponse (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) {
|
||||||
const int len = p->gNB->frame_parms.ofdm_symbol_size;
|
const int len = p->gNB->frame_parms.ofdm_symbol_size;
|
||||||
#ifndef WEBSRVSCOPE
|
#ifdef WEBSRVSCOPE
|
||||||
float *values, *time;
|
|
||||||
oai_xygraph_getbuff(graph, &time, &values, len, 0);
|
|
||||||
#else
|
|
||||||
websrv_scopedata_msg_t *msg = NULL;
|
websrv_scopedata_msg_t *msg = NULL;
|
||||||
websrv_nf_getdata(graph->graph, 0, &msg);
|
websrv_nf_getdata(graph->graph, 0, &msg);
|
||||||
float *values = (float *)msg->data_xy;
|
float *values = (float *)msg->data_xy;
|
||||||
|
#else
|
||||||
|
float *values, *time;
|
||||||
|
oai_xygraph_getbuff(graph, &time, &values, len, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const int ant = 0; // display antenna 0 for each UE
|
const int ant = 0; // display antenna 0 for each UE
|
||||||
@@ -479,15 +482,15 @@ static void timeResponse (OAIgraph_t *graph, scopeData_t *p, int nb_UEs) {
|
|||||||
for (int i=0; i<len; i++) {
|
for (int i=0; i<len; i++) {
|
||||||
values[i] = SquaredNorm(data[i]);
|
values[i] = SquaredNorm(data[i]);
|
||||||
}
|
}
|
||||||
#ifndef WEBSRVSCOPE
|
#ifdef WEBSRVSCOPE
|
||||||
oai_xygraph(graph,time,values, len, ue, 10);
|
|
||||||
#else
|
|
||||||
msg->header.msgtype = SCOPEMSG_TYPE_DATA;
|
msg->header.msgtype = SCOPEMSG_TYPE_DATA;
|
||||||
msg->header.chartid = graph->chartid;
|
msg->header.chartid = graph->chartid;
|
||||||
msg->header.datasetid = graph->datasetid;
|
msg->header.datasetid = graph->datasetid;
|
||||||
msg->header.msgseg = 0;
|
msg->header.msgseg = 0;
|
||||||
msg->header.update = 1;
|
msg->header.update = 1;
|
||||||
websrv_scope_senddata(len, 4, msg);
|
websrv_scope_senddata(len, 4, msg);
|
||||||
|
#else
|
||||||
|
oai_xygraph(graph,time,values, len, ue, 10);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1999,7 +1999,7 @@ int get_channel_params(char *buf, int debug, void *vdata, telnet_printfunc_t prn
|
|||||||
sprintf(cmdbuf, "channelmod modify %i %s %s", chanidx, pnames[pidx], tdata->lines[0].val[1]);
|
sprintf(cmdbuf, "channelmod modify %i %s %s", chanidx, pnames[pidx], tdata->lines[0].val[1]);
|
||||||
}
|
}
|
||||||
channelmod_modify_cmd(cmdbuf, debug, prnt);
|
channelmod_modify_cmd(cmdbuf, debug, prnt);
|
||||||
return 200;
|
return CMDSTATUS_FOUND;
|
||||||
} else {
|
} else {
|
||||||
prnt(" channel index not found in cannelmod command\n");
|
prnt(" channel index not found in cannelmod command\n");
|
||||||
}
|
}
|
||||||
@@ -2007,7 +2007,7 @@ int get_channel_params(char *buf, int debug, void *vdata, telnet_printfunc_t prn
|
|||||||
prnt("%s not implemented\n", buf);
|
prnt("%s not implemented\n", buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 500;
|
return CMDSTATUS_NOTFOUND;
|
||||||
|
|
||||||
} /* get_currentchannel_type */
|
} /* get_currentchannel_type */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user