File: lossgen_demo.c

package info (click to toggle)
opus 1.6-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 92,268 kB
  • sloc: ansic: 873,279; sh: 4,541; asm: 723; makefile: 480; perl: 264; python: 77
file content (22 lines) | stat: -rw-r--r-- 524 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include <stdio.h>
#include <stdlib.h>
#include "lossgen.h"
int main(int argc, char **argv)
{
   LossGenState st;
   long num_packets;
   long i;
   float percent;
   if (argc != 3) {
      fprintf(stderr, "usage: %s <percent_loss> <nb packets>\n", argv[0]);
      return 1;
   }
   lossgen_init(&st);
   percent = atof(argv[1]);
   num_packets = atol(argv[2]);
   /*printf("loss: %f %d\n", percent, num_packets);*/
   for (i=0;i<num_packets;i++) {
      printf("%d\n", sample_loss(&st, percent*0.01f));
   }
   return 0;
}