This repository has been archived by the owner on Oct 9, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
SchedulerTest.h
80 lines (60 loc) · 2 KB
/
SchedulerTest.h
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
/*
* SchedulerTest.h
* MonkeyWorksCore
*
* Created by David Cox on 3/20/07.
* Copyright 2007 __MyCompanyName__. All rights reserved.
*
*/
#ifndef _SCHEDULER_TEST_H_
#define _SCHEDULER_TEST_H_
#include "FullCoreEnvironmentTest.h"
#include <vector>
#include <boost/thread/mutex.hpp>
namespace mw {
#define N_SCHEDULED_EXECUTIONS 100
#define SLACK_MARGIN 5
#define ACCEPTABLE_ERROR_US 1000 // 100 us
void *chaff_1(const MWTime interval);
void *counter_no_payload(const boost::shared_ptr<std::vector<MWTime> > ×_array);
void *counter_small_payload(const boost::shared_ptr<std::vector<MWTime> > ×_array);
void *test_for_leaks();
void st_assert(const std::string &message,
const bool assertCondition);
double random_thing;
Lockable random_thing_lock;
bool st_Asserted;
std::string st_AssertMessage;
boost::mutex st_cppunit_lock;
class SchedulerTestFixture : public FullCoreEnvironmentTestFixture {
CPPUNIT_TEST_SUITE( SchedulerTestFixture );
CPPUNIT_TEST( testPeriod10HzNoPayload );
CPPUNIT_TEST( testPeriod100HzNoPayload );
CPPUNIT_TEST( testPeriod10HzNoPayloadChaffX4 );
//CPPUNIT_TEST( testPeriod10HzNoPayloadChaffX20 );
CPPUNIT_TEST( testPeriod10HzSmallPayload );
CPPUNIT_TEST( testOneOffFiringSmallPayload );
CPPUNIT_TEST (testSchedulerLeaks);
CPPUNIT_TEST_SUITE_END();
public:
void setUp();
void tearDown();
void testPeriod10HzNoPayload();
void testPeriod10HzSmallPayload();
void testPeriod100HzNoPayload();
void testPeriod10HzNoPayloadChaffX4();
void testOneOffFiringSmallPayload();
void testSchedulerLeaks();
protected:
std::vector<MWTime> timeTrial(MWTime interval,
int n_executions,
int n_chaff_threads);
std::vector<MWTime> timeTrialSmallPayload(MWTime interval,
int n_executions,
int n_chaff_threads);
std::vector<MWTime> diff(std::vector<MWTime> times);
void reportLatencies(std::vector<MWTime> times_array,
MWTime expected);
};
}
#endif