Last change
on this file since 1008 was
843,
checked in by devigne, 10 years ago
|
RWT Commit : Add soft directory.
Soft directory contains scripts used to validate the RWT protocol
|
File size:
1.3 KB
|
Line | |
---|
1 | |
---|
2 | #ifndef _testthread_hpp_ |
---|
3 | #define _testthread_hpp_ |
---|
4 | |
---|
5 | #include "Transaction.hpp" |
---|
6 | #include "EnsembleVariables.hpp" |
---|
7 | |
---|
8 | #include <iostream> |
---|
9 | #include <list> |
---|
10 | |
---|
11 | using namespace std; |
---|
12 | |
---|
13 | class TestThread { |
---|
14 | |
---|
15 | std::list<Transaction*> requests; |
---|
16 | |
---|
17 | public: |
---|
18 | |
---|
19 | TestThread(int nb_diff_ML, int nb_diff_CL, int nb_max_trans, int nb_max_insts, int line_size, int cache_lines, EnsembleVariables * E, int proc_id) { |
---|
20 | const int nb_trans = randint(1,nb_max_trans); |
---|
21 | for (int i = 0; i < nb_trans; i++){ |
---|
22 | Transaction *t; |
---|
23 | t = new Transaction(nb_diff_ML,nb_diff_CL,nb_max_insts,line_size,cache_lines,E,proc_id); |
---|
24 | requests.push_back(t); |
---|
25 | } |
---|
26 | } |
---|
27 | |
---|
28 | ~TestThread() { |
---|
29 | std::list<Transaction*>::iterator it; |
---|
30 | for (it = requests.begin(); it != requests.end(); it++) { |
---|
31 | delete (*it); |
---|
32 | } |
---|
33 | requests.clear(); |
---|
34 | } |
---|
35 | |
---|
36 | string writeOutput(int i) { |
---|
37 | stringstream res; |
---|
38 | res << "void run" << i << "() {" << endl; |
---|
39 | res << " int local_var; // variable pour pouvoir avoir des transactions où l'on ne fait que lire les variables utiles" << endl; |
---|
40 | res << endl; |
---|
41 | |
---|
42 | std::list<Transaction*>::iterator it; |
---|
43 | for (it = requests.begin(); it != requests.end(); it++) { |
---|
44 | res << (*it)->writeOutput(); |
---|
45 | } |
---|
46 | |
---|
47 | res << "}" << endl; |
---|
48 | res << endl; |
---|
49 | return res.str(); |
---|
50 | } |
---|
51 | |
---|
52 | }; |
---|
53 | |
---|
54 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.