-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
50 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "CE_Throughput_Test.hpp" | ||
#include "ECR.hpp" | ||
#include <stdio.h> | ||
#include <timer.h> | ||
#include <sys/time.h> | ||
#include "CE_Throughput_Test.hpp" | ||
|
||
// constructor | ||
CE_Throughput_Test::CE_Throughput_Test() { | ||
first_execution = 1; | ||
} | ||
|
||
// destructor | ||
CE_Throughput_Test::~CE_Throughput_Test() {} | ||
|
||
// execute function | ||
void CE_Throughput_Test::execute(ExtensibleCognitiveRadio *ECR) { | ||
|
||
if (first_execution) { | ||
// Print the estimated network throughput (assuming perfect reception). | ||
// The 256/288 factor is to account for the header added by the TUN interface. | ||
float phy_data_rate = ECR->get_tx_data_rate(); | ||
printf("Estimated network throughput: %e\n", (256.0/288.0)*phy_data_rate); | ||
ECR->set_ce_timeout_ms(200.0); | ||
first_execution = 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef _CE_THROUGHPUT_TEST_ | ||
#define _CE_THROUGHPUT_TEST_ | ||
|
||
#include "CE.hpp" | ||
#include <sys/time.h> | ||
|
||
class CE_Throughput_Test : public Cognitive_Engine { | ||
|
||
private: | ||
int first_execution; | ||
public: | ||
CE_Throughput_Test(); | ||
~CE_Throughput_Test(); | ||
virtual void execute(ExtensibleCognitiveRadio *ECR); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters