MCPcopy Create free account
hub / github.com/apache/trafficserver / main

Function main

plugins/esi/test/sampleProb.cc:172–196  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170
171const std::string fetchURL = "www.example.com";
172int
173main(int argc, char **argv)
174{
175 // Simulate the scenario
176 FailureData data;
177 int noOfAttempt = 0, noOfExcept = 0;
178
179 int count = atoi(argv[1]);
180 while (count--) {
181 int decision = rand() % 100;
182
183 if (isAttemptReq(fetchURL, data)) {
184 noOfAttempt++;
185 if (decision >= atoi(argv[2]) && 0)
186 registerSuccFail(fetchURL, data, true);
187
188 else
189 registerSuccFail(fetchURL, data, false);
190 } else
191 noOfExcept++;
192 }
193
194 cout << " SERVED FROM ATTEMPT " << noOfAttempt << " TOTAL " << atoi(argv[1]) << endl;
195 cout << " SERVED FROM EXCEPT " << noOfExcept << " TOTAL " << atoi(argv[1]) << endl;
196}

Callers

nothing calls this directly

Calls 2

isAttemptReqFunction · 0.85
registerSuccFailFunction · 0.85

Tested by

no test coverage detected