MCPcopy Create free account
hub / github.com/SIPp/sipp / nextLine

Method nextLine

src/infile.cpp:253–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

251}
252
253int FileContents::nextLine(int userId)
254{
255 switch(usage) {
256 case InputFileRandomOrder:
257 return rand() % numLinesInFile;
258 case InputFileSequentialOrder: {
259 int ret = lineCounter;
260 lineCounter = (lineCounter + 1) % numLinesInFile;
261 return ret;
262 }
263 case InputFileUser:
264 if (userId == 0) {
265 return -1;
266 }
267 if ((userId - 1) >= numLinesInFile) {
268 ERROR("%s has only %d lines, yet user %d was requested.", fileName, numLinesInFile, userId);
269 }
270 return userId - 1;
271 default:
272 ERROR("Internal error: unknown file usage mode!");
273 return -1;
274 }
275}
276
277void FileContents::dump(void)
278{

Callers 1

initMethod · 0.80

Calls 1

ERRORFunction · 0.85

Tested by

no test coverage detected