const int prio_to_ac[8] = {2,3,3,2,1,1,0,0};
const unsigned int ac_to_tos[4] = {224,160,96,64};
+const char *ac_to_text[4] = {[AC_VO] = "AC_VO", [AC_VI] = "AC_VI", [AC_BE] = "AC_BE", [AC_BK] = "AC_BK", };
void set_rt_prio(int priority)
{
extern const int prio_to_ac[8];
extern const unsigned int ac_to_tos[4];
+extern const char *ac_to_text[4];
void block_signals(void);
void set_rt_prio(int priority);
#include "common.h"
#include <semaphore.h>
-/*#define AC_VO 0
-#define AC_VI 1
-#define AC_BE 2
-#define AC_BK 3
-*/
-
#define PARAM_SERVERADDR 1
#define MAX_SENDENDPOINTS 10
struct receiver {
pthread_t thread;
+ unsigned received, last_received;
} receivers[AC_QUEUES];
FILE* logfd;
if (trans_time_usec < MAX_DELAY_US)
delay_stats[ac][trans_time_usec/GRANULARITY]++;
+
+ receivers[ac].received++;
/*if (trans_time_nsec < min_trans_time)
min_trans_time = trans_time_nsec;*/
}
while (!exit_flag) {
- sleep(100000);
+ printf("\r");
+ for (ac = 0; ac<AC_QUEUES; ac++) {
+ int delta = receivers[ac].received - receivers[ac].last_received;
+ receivers[ac].last_received = receivers[ac].received;
+ printf("%s: %5d (+%4d) ", ac_to_text[ac], receivers[ac].received, delta);
+ }
+ fflush(stdout);
+ sleep(1);
}
- printf("Waiting for threads to finish\n");
+ printf("\nWaiting for threads to finish\n");
/* Wait for all threads to finish */
for (i=0; i < nr_sepoints + AC_QUEUES; i++) {
sem_wait(&sem_thread_finished);
}
+ printf("\n");
save_results();
int ac_sockfd[AC_QUEUES];
+struct receiver {
+ unsigned received, last_received;
+} receivers[AC_QUEUES];
+
void stopper()
{
#ifdef DEBUG
printf("%d",ac);
fflush(stdout);
-#endif
+#endif
+ receivers[ac].received++;
while (sendto(ac_sockfd[ac], buff, mlen,0 ,(struct sockaddr*)&rem_addr, \
sizeof(rem_addr)) < 0){
if (errno == EINTR) continue;
int main(int argc, char *argv[])
{
- int i,rc;
+ int ac,rc;
pthread_attr_t attr;
pthread_t thread;
exit(1);
}
- for (i = 0; i < AC_QUEUES; i++) {
- ac_sockfd[i] = create_ac_socket(i);
- rc = pthread_create(&thread, &attr, qhandler, (void*) i);
+ for (ac = 0; ac < AC_QUEUES; ac++) {
+ ac_sockfd[ac] = create_ac_socket(ac);
+ rc = pthread_create(&thread, &attr, qhandler, (void*) ac);
}
while (1) {
- sleep(100000);
+ printf("\r");
+ for (ac = 0; ac<AC_QUEUES; ac++) {
+ int delta = receivers[ac].received - receivers[ac].last_received;
+ receivers[ac].last_received = receivers[ac].received;
+ printf("%s: %5d (+%4d) ", ac_to_text[ac], receivers[ac].received, delta);
+ }
+ fflush(stdout);
+ sleep(1);
}
+ printf("\n");
return 0;