-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWrapper.cpp
More file actions
159 lines (145 loc) · 4.4 KB
/
Copy pathWrapper.cpp
File metadata and controls
159 lines (145 loc) · 4.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include <iostream>
#include "ArrayLDPCMacro.h"
#include "ArrayLDPC.h"
#include "PerfTest.h"
#include <windows.h>
using std::endl;
using std::cout;
using std::cin;
int main(int argc, char *argv[])
{
//char Filename[30];
double db_start, db_end, db_step;
double Rate, EbN0, snr;
int i = 0;
if(argc == 5)
{
//printf("%.1f, %.1f, %.1f, %s\n", atof(argv[1]),atof(argv[2]),atof(argv[3]),argv[4]);
//ArrayLDPC_PerfTest(atof(argv[1]), atof(argv[2]), atof(argv[3]), argv[4]);
ArrayLDPC_PerfTest(2, 2, 1, "test.csv");
}
else if(1) // debugging
{
//ArrayLDPC_Debug_Shorten(36);
ArrayLDPC_Debug_Wifi();
return 0;
long MaxPckNum;
printf("argc = %d \n time trial with: manual input\n", argc);
cout << "EbN0 in dB: ";
cin >> EbN0;
cout << "simulate how many packets? ( " << 2209 << " is the codeword length ): ";
cin >> MaxPckNum;
char InfoStream[248] = "OMG how long should this string be to make it 248, just imagine that. \
I guess it's still not long enough. Let's see. This is a testing string \
for a lot of characters so that we have some random bit stream that's\
correct";
//---- code timging for windows
//---- encoder trial
//EncodeTrial(InfoStream, MaxPckNum);
//---- decoder trial
//DecodeTrial(EbN0, MaxPckNum);
//---- test error rate
//ArrayLDPC_Debug();
}
else
{
long MaxPckNum;
printf("argc = %d \n time trial with: manual input\n", argc);
cout << "EbN0 in dB: ";
cin >> db_start;
cout << "simulate how many packets? ( " << 2209 << " is the codeword length ): ";
cin >> MaxPckNum;
//---- code timging for windows
//---- should create a linux version too
__int64 ctr1 = 0, ctr2 = 0, freq = 0;
// Start timing the code.
if(QueryPerformanceCounter((LARGE_INTEGER *) &ctr1) != 0)
{
// Do what ever you do, what ever you need to time...
// Finish timing the code.
ArrayLDPC_TimeTrial(db_start, MaxPckNum, "timing.txt");
QueryPerformanceCounter((LARGE_INTEGER *) &ctr2);
QueryPerformanceFrequency((LARGE_INTEGER *) &freq);
// Print the time spent in microseconds to the console.
std::cout << ((ctr2 - ctr1) * 1.0 / freq) << " seconds" << std::endl;
std::cout << 2209*MaxPckNum/((ctr2 - ctr1) * 1.0 / freq) << " bits per second" << std::endl;
}
//cout << "csv filname:";
//cin >> Filename;
}
//else
//{
// //cout << "snr from:";
// //cin >> db_start;
// //cout << "snr end:";
// //cin >> db_end;
// //cout << "snr step:";
// //cin >> db_step;
// //cout << "csv filname:";
// //cin >> Filename;
// ArrayLDPC_PerfTest(1, 2, 1, "test.csv");
//}
system("pause");
return 0;
}
//---------- PerfTest Main
//int main(int argc, char *argv[])
//{
// //char Filename[30];
// double db_start, db_end, db_step;
// int i = 0;
// if(argc == 5)
// {
// printf("%.1f, %.1f, %.1f, %s\n", atof(argv[1]),atof(argv[2]),atof(argv[3]),argv[4]);
// ArrayLDPC_PerfTest(atof(argv[1]), atof(argv[2]), atof(argv[3]), argv[4]);
// }
// else
// {
// long MaxPckNum;
// printf("argc = %d \n time trial with: manual input\n", argc);
// cout << "EbN0 in dB: ";
// cin >> db_start;
// cout << "simulate how many packets? ( " << 2209 << " is the codeword length ): ";
// cin >> MaxPckNum;
//
// //---- code timging for windows
// //---- should create a linux version too
// __int64 ctr1 = 0, ctr2 = 0, freq = 0;
// // Start timing the code.
// if(QueryPerformanceCounter((LARGE_INTEGER *) &ctr1) != 0)
// {
// // Do what ever you do, what ever you need to time...
//
// // Finish timing the code.
// ArrayLDPC_TimeTrial(db_start, MaxPckNum, "timing.txt");
// QueryPerformanceCounter((LARGE_INTEGER *) &ctr2);
// QueryPerformanceFrequency((LARGE_INTEGER *) &freq);
//
// // Print the time spent in microseconds to the console.
//
// std::cout << ((ctr2 - ctr1) * 1.0 / freq) << " seconds" << std::endl;
// std::cout << 2209*MaxPckNum/((ctr2 - ctr1) * 1.0 / freq) << " bits per second" << std::endl;
// }
// //cout << "csv filname:";
// //cin >> Filename;
//
// }
// //else
// //{
// // //cout << "snr from:";
// // //cin >> db_start;
// // //cout << "snr end:";
// // //cin >> db_end;
// // //cout << "snr step:";
// // //cin >> db_step;
// // //cout << "csv filname:";
// // //cin >> Filename;
// // ArrayLDPC_PerfTest(1, 2, 1, "test.csv");
// //}
// //system("pause");
// return 0;
//}