#include <fsm.h>
Collaboration diagram for FSMState:

Public Member Functions | |
| FSMState () | |
Public Attributes | |
| int | batch_size_ |
| int | transition_ [17] |
| FSMState * | drop_ [17] |
| int | print_i_ |
Protected Member Functions | |
| void | number_all () |
| void | print_all (int level) |
| void | print_all_stats (int desired_pkts, int pkts=0, int rtts=0, int timeouts=0, int ps=0, int qs=0, int num_states=0, int num_state_names=0) |
| void | reset_all_processed () |
| bool | processed () |
Friends | |
| class | FSM |
|
|
Definition at line 42 of file fsm.h. References print_i_.
00042 : print_i_(0) {}; |
|
|
Definition at line 58 of file fsm.cc. References drop_, print_i_, and processed(). Referenced by reset_all_processed().
00059 {
00060 if (processed())
00061 return;
00062 static int next_i = 0;
00063 print_i_ = ++next_i;
00064 //
00065 int i;
00066 for (i = 0; i < 17; i++)
00067 if (drop_[i])
00068 drop_[i]->number_all();
00069 }
|
Here is the call graph for this function:

|
|
Definition at line 87 of file fsm.cc. References batch_size_, drop_, print_i_, processed(), TIMEOUT, and transition_. Referenced by FSM::print_FSM().
00088 {
00089 if (processed())
00090 return;
00091
00092 const int SPACES_PER_LEVEL = 2;
00093 printf("#%-2d %*s %d:\n", print_i_, level * SPACES_PER_LEVEL + 1, " ", batch_size_);
00094 int i;
00095 for (i = 0; i <= batch_size_; i++) {
00096 static char *delay_names[] = {"done", "error", "RTT", "timeout" };
00097 assert(transition_[i] >= -1 && transition_[i] <= TIMEOUT);
00098 printf(" %*s %d %s -> #%d\n", level * SPACES_PER_LEVEL + 3, " ",
00099 i,
00100 delay_names[transition_[i]+1],
00101 drop_[i] ? drop_[i]->print_i_ : 0);
00102 if (drop_[i])
00103 drop_[i]->print_all(level + 1);
00104 };
00105 }
|
Here is the call graph for this function:

|
||||||||||||||||||||||||||||||||||||
|
Definition at line 143 of file fsm.cc. References batch_size_, drop_, MAX, MIN, report_stat_terminus(), RTT, states, TIMEOUT, and transition_. Referenced by FSM::print_FSM_stats().
00151 {
00152 int i;
00153 #define LARGER_NUMBER_OF_STATES 31 // was 17
00154 static FSMState *states[LARGER_NUMBER_OF_STATES];
00155 static char state_names[LARGER_NUMBER_OF_STATES*4]; // xxx: this is just some random big size :-(
00156
00157 if (pkts >= desired_pkts_total || qs > 5) {
00158 // done; print states and probability
00159 // (give up when we're where we want to be [good],
00160 // or we've taken too many losses [to prevent recursion])
00161 report_stat_terminus(desired_pkts_total, pkts, rtts, timeouts, ps, qs, num_states, num_state_names, states, state_names);
00162 return;
00163 };
00164
00165 // remember us!
00166 states[num_states] = this;
00167 num_states++;
00168
00169
00170 // xxx: doesn't handle TCP tail behavior
00171
00172 //
00173 // first, consider the no-loss case
00174 //
00175 int desired_pkts_remaining = desired_pkts_total - pkts;
00176 int desired_pkts_this_round = MIN(desired_pkts_remaining, batch_size_);
00177 for (i = 0; i< desired_pkts_this_round; i++)
00178 state_names[num_state_names + i] = 's';
00179 if (desired_pkts_remaining > desired_pkts_this_round) {
00180 // more to do? take a rtt hit and keep going
00181 state_names[num_state_names + desired_pkts_this_round] = '.';
00182 drop_[0]->print_all_stats(desired_pkts_total,
00183 pkts + desired_pkts_this_round,
00184 rtts + 1, timeouts,
00185 ps + desired_pkts_this_round, qs,
00186 num_states,
00187 num_state_names + desired_pkts_this_round + 1);
00188 } else {
00189 // no more to do... report out
00190 report_stat_terminus(desired_pkts_total,
00191 pkts + desired_pkts_this_round,
00192 rtts, timeouts,
00193 ps + desired_pkts_this_round, qs,
00194 num_states,
00195 num_state_names + desired_pkts_this_round,
00196 states,
00197 state_names);
00198 };
00199
00200 //
00201 // now consider losses
00202 //
00203 int desired_pkts_with_loss = MAX(desired_pkts_this_round - 1, 0);
00204 // loop through losing the i'th packet for all possible i's.
00205 // Can't loop through more than we could have sent.
00206 for (i = 1; i <= desired_pkts_this_round; i++) {
00207 // keep track of sending patterns
00208 if (i > 1)
00209 state_names[num_state_names + i - 2] = 's';
00210 state_names[num_state_names + i - 1] = 'd';
00211 state_names[num_state_names + desired_pkts_this_round] = (transition_[i] == RTT ? '.' : '-');
00212 // can we even have any?
00213 if (qs) {
00214 // not if we already had one!
00215 report_stat_terminus(desired_pkts_total,
00216 pkts + i - 1,
00217 rtts, timeouts,
00218 ps + i - 1, qs + 1,
00219 num_states,
00220 num_state_names + i,
00221 states,
00222 state_names);
00223 } else {
00224 // recurse... assume the rest made it
00225 drop_[i]->print_all_stats(desired_pkts_total, pkts + desired_pkts_with_loss,
00226 rtts + (transition_[i] == RTT ? 1 : 0),
00227 timeouts + (transition_[i] == TIMEOUT ? 1 : 0),
00228 ps + desired_pkts_with_loss, qs + 1,
00229 num_states,
00230 num_state_names + desired_pkts_this_round + 1);
00231 // 2nd drop somewhere in this round?
00232 int remaining_pkts_this_round = desired_pkts_this_round - i;
00233 if (qs == 0 && remaining_pkts_this_round > 0) {
00234 // yes, generate the probs
00235 int j;
00236 for (j = i+1; j <= desired_pkts_this_round; j++) {
00237 if (j > i+1)
00238 state_names[num_state_names + j - 1] = 's';
00239 state_names[num_state_names + j] = 'd';
00240 report_stat_terminus(desired_pkts_total,
00241 pkts + j - 2,
00242 rtts, timeouts,
00243 ps + j - 2, qs + 2,
00244 num_states,
00245 num_state_names + j,
00246 states,
00247 state_names);
00248 };
00249 };
00250 };
00251 };
00252 }
|
Here is the call graph for this function:

|
|
Definition at line 40 of file fsm.h. References print_i_. Referenced by number_all(), print_all(), and reset_all_processed().
00040 { return print_i_ < 0; }
|
|
|
Definition at line 72 of file fsm.cc. References drop_, number_all(), print_i_, and processed(). Referenced by FSM::print_FSM(), and FSM::print_FSM_stats().
00073 {
00074 if (print_i_ == 0)
00075 number_all();
00076 // requires a full traversal always to work
00077 if (!processed())
00078 return;
00079 print_i_ = -print_i_;
00080 int i;
00081 for (i = 0; i < 17; i++)
00082 if (drop_[i])
00083 drop_[i]->reset_all_processed();
00084 }
|
Here is the call graph for this function:

|
|
|
|
|
Definition at line 44 of file fsm.h. Referenced by print_all(), print_all_stats(), FSM::print_FSM(), RenoAckFSM::RenoAckFSM(), RenoDelAckFSM::RenoDelAckFSM(), AbsTcpAgent::send_batch(), TahoeAckFSM::TahoeAckFSM(), TahoeDelAckFSM::TahoeDelAckFSM(), and AbsTcpAgent::timeout(). |
|
|
Definition at line 49 of file fsm.h. Referenced by number_all(), print_all(), print_all_stats(), FSM::print_FSM(), RenoAckFSM::RenoAckFSM(), RenoDelAckFSM::RenoDelAckFSM(), reset_all_processed(), AbsTcpAgent::send_batch(), TahoeAckFSM::TahoeAckFSM(), TahoeDelAckFSM::TahoeDelAckFSM(), and AbsTcpAgent::timeout(). |
|
|
Definition at line 50 of file fsm.h. Referenced by FSMState(), number_all(), print_all(), processed(), and reset_all_processed(). |
|
|
Definition at line 47 of file fsm.h. Referenced by print_all(), print_all_stats(), FSM::print_FSM(), RenoAckFSM::RenoAckFSM(), RenoDelAckFSM::RenoDelAckFSM(), AbsTcpAgent::send_batch(), TahoeAckFSM::TahoeAckFSM(), TahoeDelAckFSM::TahoeDelAckFSM(), and AbsTcpAgent::timeout(). |
1.3.3