Skip to content

spectrum: Keep results file open and do not append to previous content

Eduardo Almeida requested to merge edalm/ns-3-dev:ntn-example-file into master

The example src/spectrum/examples/three-gpp-ntn-channel-example.cc is opening, appending a line and closing the output results file for every new parameter. This has two problems:

  • The performance degrades, since I/O operations are computationally expensive.
  • The previous content of the file (generated from a previous simulation run) is not erased, leading to subsequent runs of the example adding content rather than overwriting it.

This MR fixes both problems by opening the file only once per simulation run.

Merge request reports

Loading