Commit 75202181 authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

Merge remote-tracking branch 'origin/t-hacks-small-improvement' into integration_2025_w04 (!3217)

minor improvements in T hacks
parents 26607689 fc4cc9ef
...@@ -31,7 +31,7 @@ CMake Error at /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:463 (message): ...@@ -31,7 +31,7 @@ CMake Error at /usr/share/cmake-3.16/Modules/FindPkgConfig.cmake:463 (message):
Run: Run:
```shell ```shell
sudo apt-get install libxft-dev sudo apt-get install libx11-dev libpng-dev libxft-dev
``` ```
## Run the softmodem ## Run the softmodem
......
...@@ -25,4 +25,4 @@ multi-rru-clean: ../utils.o ../database.o ../event.o ../configuration.o multi-rr ...@@ -25,4 +25,4 @@ multi-rru-clean: ../utils.o ../database.o ../event.o ../configuration.o multi-rr
$(CC) $(CFLAGS) -c -o $@ $< $(CC) $(CFLAGS) -c -o $@ $<
clean: clean:
rm -f *.o core dump_nack_signal time_meas timeplot rm -f *.o core dump_nack_signal time_meas timeplot multi-rru-clean
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdint.h>
#include "utils.h" #include "utils.h"
#include "event.h" #include "event.h"
#include "database.h" #include "database.h"
...@@ -14,7 +15,8 @@ void usage(void) ...@@ -14,7 +15,8 @@ void usage(void)
" -d <database file> this option is mandatory\n" " -d <database file> this option is mandatory\n"
" -ip <host> connect to given IP address (default %s)\n" " -ip <host> connect to given IP address (default %s)\n"
" -p <port> connect to given port (default %d)\n" " -p <port> connect to given port (default %d)\n"
" -e <event> event to trace (default VCD_FUNCTION_ENB_DLSCH_ULSCH_SCHEDULER)\n", " -e <event> event to trace (default VCD_FUNCTION_ENB_DLSCH_ULSCH_SCHEDULER)\n"
" -s stat mode, print every second min/avg/max + count\n",
DEFAULT_REMOTE_IP, DEFAULT_REMOTE_IP,
DEFAULT_REMOTE_PORT DEFAULT_REMOTE_PORT
); );
...@@ -34,6 +36,21 @@ struct timespec time_sub(struct timespec a, struct timespec b) ...@@ -34,6 +36,21 @@ struct timespec time_sub(struct timespec a, struct timespec b)
return ret; return ret;
} }
volatile uint64_t acc, count, acc_min, acc_max;
void *stat_thread(void *_)
{
while (1) {
uint64_t v = acc;
uint64_t c = count;
uint64_t min = acc_min;
uint64_t max = acc_max;
acc = acc_min = acc_max = count = 0;
printf("%ld %ld %ld [%ld]\n", min, c==0 ? 0 : v/c, max, c);
sleepms(1000);
}
}
int main(int n, char **v) int main(int n, char **v)
{ {
char *database_filename = NULL; char *database_filename = NULL;
...@@ -49,6 +66,7 @@ int main(int n, char **v) ...@@ -49,6 +66,7 @@ int main(int n, char **v)
int start_valid = 0; int start_valid = 0;
struct timespec start_time, stop_time, delta_time; struct timespec start_time, stop_time, delta_time;
char *name = "VCD_FUNCTION_ENB_DLSCH_ULSCH_SCHEDULER"; char *name = "VCD_FUNCTION_ENB_DLSCH_ULSCH_SCHEDULER";
int stat_mode = 0;
for (i = 1; i < n; i++) { for (i = 1; i < n; i++) {
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage(); if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
...@@ -58,9 +76,13 @@ int main(int n, char **v) ...@@ -58,9 +76,13 @@ int main(int n, char **v)
if (!strcmp(v[i], "-p")) if (!strcmp(v[i], "-p"))
{ if (i > n-2) usage(); port = atoi(v[++i]); continue; } { if (i > n-2) usage(); port = atoi(v[++i]); continue; }
if (!strcmp(v[i], "-e")) { if (i > n-2) usage(); name = v[++i]; continue; } if (!strcmp(v[i], "-e")) { if (i > n-2) usage(); name = v[++i]; continue; }
if (!strcmp(v[i], "-s")) { stat_mode = 1; continue; }
usage(); usage();
} }
if (stat_mode)
new_thread(stat_thread, NULL);
if (database_filename == NULL) { if (database_filename == NULL) {
printf("ERROR: provide a database file (-d)\n"); printf("ERROR: provide a database file (-d)\n");
exit(1); exit(1);
...@@ -96,7 +118,8 @@ int main(int n, char **v) ...@@ -96,7 +118,8 @@ int main(int n, char **v)
if (e.type != ev_fun) if (e.type != ev_fun)
{ printf("unhandled event %d\n", e.type); continue; } { printf("unhandled event %d\n", e.type); continue; }
on_off = e.e[0].i; on_off = e.e[0].i;
printf("yo %d\n", on_off); if (!stat_mode)
printf("yo %d\n", on_off);
if (on_off == 1) { if (on_off == 1) {
start_time = e.sending_time; start_time = e.sending_time;
start_valid = 1; start_valid = 1;
...@@ -104,11 +127,20 @@ printf("yo %d\n", on_off); ...@@ -104,11 +127,20 @@ printf("yo %d\n", on_off);
} }
if (on_off != 0) { printf("fatal!\n"); abort(); } if (on_off != 0) { printf("fatal!\n"); abort(); }
if (!start_valid) continue; if (!start_valid) continue;
start_valid = 0;
stop_time = e.sending_time; stop_time = e.sending_time;
delta_time = time_sub(stop_time, start_time); delta_time = time_sub(stop_time, start_time);
fprintf(stderr, "%ld\n", if (stat_mode) {
delta_time.tv_sec * 1000000000UL + delta_time.tv_nsec); uint64_t v = delta_time.tv_sec * 1000000000UL + delta_time.tv_nsec;
fflush(stderr); if (count == 0 || v < acc_min) acc_min = v;
if (v > acc_max) acc_max = v;
acc += v;
count++;
} else {
fprintf(stderr, "%ld\n",
delta_time.tv_sec * 1000000000UL + delta_time.tv_nsec);
fflush(stderr);
}
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment