DescriptionThis is the second of three of patches to address Bug 582,
"Tags are not serialized and deserialized from Packet::Serialize and
Packet::Deserialize"
https://www.nsnam.org/bugzilla/show_bug.cgi?id=582
<repeat of Hash discussion>
One issue is to serialize the *type* of the derived Tag, when the Packet only
has a PacketTagList to work from. This serialization has to produce a
consistent result on every compute node in a parallel cluster, even one with
heterogeneous nodes. This can be particularly tricky if the different instances
of ns3 don't create TypeId's in the same order, which results in a single type
(by name) being represented by different TypeId values (integers) on different
nodes.
One approach, partially implemented by Jeffrey Young at Georgia Tech, is to
serialize the TypeId name (a string). This seems unattractive because it takes
time and space, typically much more space than the tag data itself (which is
limited to 20 bytes).
The alternative approach proposed here is to add a consistent 32-bit hash to
the
TypeId, then pass that to identify the tag type.
To simplify review, I've split this into three patches:
1. Add class Hash: generic hash function interface, with two implementations.
2. Add hashes to TypeId (this review).
3. Use TypeId hash to serialize Tags.
</repeat>
This patch does three things:
* Add a hash value to the TypeId; allow lookup by hash.
* Add two maps to IidManager, to speed lookups by name or hash. Microbenchmarks show this is significantly faster with our 400 registered TypeIds.
* Add a TypeId test suite.
Note: this is to be applied *on top of* the Hash patch,
http://codereview.appspot.com/6357056/
Patch Set 1 #
Total comments: 13
Patch Set 2 : Revised patch #
MessagesTotal messages: 4
|