File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change 4949#include " opts.h"
5050#include " packet.h"
5151#include " scheduler.h"
52+ #include " utils/random.h"
5253#include " utils/time.h"
5354
5455using bess::Scheduler;
@@ -265,6 +266,7 @@ int Worker::BlockWorker() {
265266/* The entry point of worker threads */
266267void *Worker::Run (void *_arg) {
267268 struct thread_arg <Task> *arg = (struct thread_arg <Task> *)_arg;
269+ rand_ = new Random ();
268270
269271 cpu_set_t set;
270272
@@ -308,6 +310,7 @@ void *Worker::Run(void *_arg) {
308310 << " )" ;
309311
310312 delete scheduler_;
313+ delete rand_;
311314
312315 return nullptr ;
313316}
Original file line number Diff line number Diff line change 4242#include " pktbatch.h"
4343#include " traffic_class.h"
4444#include " utils/common.h"
45+ #include " utils/random.h"
4546
4647// XXX
4748typedef uint16_t gate_idx_t ;
@@ -124,6 +125,8 @@ class Worker {
124125
125126 bess::PacketBatch **splits () { return splits_; }
126127
128+ Random *rand () const { return rand_; }
129+
127130 private:
128131 volatile worker_status_t status_;
129132
@@ -145,6 +148,8 @@ class Worker {
145148 * Modules should use get_igate() for access */
146149 gate_idx_t current_igate_;
147150
151+ Random *rand_;
152+
148153 // For each possible output gate contains a pointer to a batch, or nullptr,
149154 // if no batch has been associated with the output gate yet.
150155 //
You can’t perform that action at this time.
0 commit comments