bug 954: Changing the simulation time resolution does not work well with attributes

This commit is contained in:
Peter D. Barnes, Jr.
2012-12-08 21:23:44 -08:00
parent 2695a9f9ce
commit 3086fb5c95
5 changed files with 371 additions and 185 deletions

View File

@@ -313,7 +313,7 @@ section, so go ahead and expand that documentation node. Now, expand the
``Debugging`` book and then select the ``Logging`` page.
You should now be looking at the Doxygen documentation for the Logging module.
In the list of ``#define`` s at the top of the page you will see the entry
In the list of ``#define``'s at the top of the page you will see the entry
for ``NS_LOG_COMPONENT_DEFINE``. Before jumping in, it would probably be
good to look for the "Detailed Description" of the logging module to get a
feel for the overall operation. You can either scroll down or select the
@@ -340,6 +340,20 @@ Just as in any C++ program, you need to define a main function that will be
the first function run. There is nothing at all special here. Your
|ns3| script is just a C++ program.
The next line sets the time resolution to one nanosecond, which happens
to be the default value:
::
Time::SetResolution (Time::NS);
You can change the resolution exactly once (which must be before
``Simulator::Run ()`` is called, below). The mechanism enabling this
flexibility is somewhat memory hungry, so once the resolution has been
set explicitly we release the memory, preventing further updates. (If
you don't set the resolution explicitly, it will default to one nanosecond,
and the memory will be released when the simulation starts.)
The next two lines of the script are used to enable two logging components that
are built into the Echo Client and Echo Server applications: