traffic_gen.cc (9524:d6ffa982a68b) traffic_gen.cc (9584:1a21964b7227)
1/*
2 * Copyright (c) 2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 310 unchanged lines hidden (view full) ---

319TrafficGen::StateGraph::transition()
320{
321 // exit the current state
322 states[currState]->exit();
323
324 // determine next state
325 double p = random_mt.gen_real1();
326 assert(currState < transitionMatrix.size());
1/*
2 * Copyright (c) 2012 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

--- 310 unchanged lines hidden (view full) ---

319TrafficGen::StateGraph::transition()
320{
321 // exit the current state
322 states[currState]->exit();
323
324 // determine next state
325 double p = random_mt.gen_real1();
326 assert(currState < transitionMatrix.size());
327 double cumulative = transitionMatrix[currState][0];
328 size_t i = 1;
329 while (p < cumulative && i != transitionMatrix[currState].size()) {
327 double cumulative = 0.0;
328 size_t i = 0;
329 do {
330 cumulative += transitionMatrix[currState][i];
331 ++i;
330 cumulative += transitionMatrix[currState][i];
331 ++i;
332 }
333 enterState(i);
332 } while (cumulative < p && i < transitionMatrix[currState].size());
333
334 enterState(i - 1);
334}
335
336void
337TrafficGen::StateGraph::enterState(uint32_t newState)
338{
339 DPRINTF(TrafficGen, "Transition to state %d\n", newState);
340
341 currState = newState;

--- 276 unchanged lines hidden ---
335}
336
337void
338TrafficGen::StateGraph::enterState(uint32_t newState)
339{
340 DPRINTF(TrafficGen, "Transition to state %d\n", newState);
341
342 currState = newState;

--- 276 unchanged lines hidden ---