LEFT | RIGHT |
(no file at all) | |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2012 Lawrence Livermore National Laboratory | 3 * Copyright (c) 2012 Lawrence Livermore National Laboratory |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 5 * This program is free software; you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 2 as | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 ·· | 69 ·· |
70 // Use same custom hasher as TypeId | 70 // Use same custom hasher as TypeId |
71 ns3::Hasher hasher = ns3::Hasher ( Create<Hash::Function::Murmur3> () ); | 71 ns3::Hasher hasher = ns3::Hasher ( Create<Hash::Function::Murmur3> () ); |
72 ·· | 72 ·· |
73 uint32_t nids = TypeId::GetRegisteredN (); | 73 uint32_t nids = TypeId::GetRegisteredN (); |
74 | 74 |
75 cout << suite << "UniqueTypeIdTestCase: nids: " << nids << endl; | 75 cout << suite << "UniqueTypeIdTestCase: nids: " << nids << endl; |
76 cout << suite << "TypeId list:" << endl; | 76 cout << suite << "TypeId list:" << endl; |
77 cout << suite << "TypeId Chain hash Name" << endl; | 77 cout << suite << "TypeId Chain hash Name" << endl; |
78 ·· | 78 ·· |
79 for (uint32_t i = 0; i < nids; ++i) | 79 for (uint16_t i = 0; i < nids; ++i) |
80 { | 80 { |
81 const TypeId tid = TypeId::GetRegistered (i); | 81 const TypeId tid = TypeId::GetRegistered (i); |
82 cout << suite << "" << std::setw(6) << tid.GetUid (); | 82 cout << suite << "" << std::setw(6) << tid.GetUid (); |
83 if (tid.GetHash () & HashChainFlag) | 83 if (tid.GetHash () & HashChainFlag) |
84 { | 84 { |
85 cout << " chain"; | 85 cout << " chain"; |
86 } | 86 } |
87 else | 87 else |
88 { | 88 { |
89 cout << " "; | 89 cout << " "; |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 LookupTimeTestCase::DoRun (void) | 356 LookupTimeTestCase::DoRun (void) |
357 { | 357 { |
358 cout << suite << endl; | 358 cout << suite << endl; |
359 cout << suite << GetName () << endl; | 359 cout << suite << GetName () << endl; |
360 ·· | 360 ·· |
361 uint32_t nids = TypeId::GetRegisteredN (); | 361 uint32_t nids = TypeId::GetRegisteredN (); |
362 | 362 |
363 int start = clock (); | 363 int start = clock (); |
364 for (uint32_t j = 0; j < REPETITIONS; ++j) | 364 for (uint32_t j = 0; j < REPETITIONS; ++j) |
365 { | 365 { |
366 for (uint32_t i = 0; i < nids; ++i) | 366 for (uint16_t i = 0; i < nids; ++i) |
367 { | 367 { |
368 const TypeId tid = TypeId::GetRegistered (i); | 368 const TypeId tid = TypeId::GetRegistered (i); |
369 const TypeId sid = TypeId::LookupByName (tid.GetName ()); | 369 const TypeId sid = TypeId::LookupByName (tid.GetName ()); |
370 } | 370 } |
371 } | 371 } |
372 int stop = clock (); | 372 int stop = clock (); |
373 Report ("name", stop - start); | 373 Report ("name", stop - start); |
374 | 374 |
375 start = clock (); | 375 start = clock (); |
376 for (uint32_t j = 0; j < REPETITIONS; ++j) | 376 for (uint32_t j = 0; j < REPETITIONS; ++j) |
377 { | 377 { |
378 for (uint32_t i = 0; i < nids; ++i) | 378 for (uint16_t i = 0; i < nids; ++i) |
379 { | 379 { |
380 const TypeId tid = TypeId::GetRegistered (i); | 380 const TypeId tid = TypeId::GetRegistered (i); |
381 const TypeId sid = TypeId::LookupByHash (tid.GetHash ()); | 381 const TypeId sid = TypeId::LookupByHash (tid.GetHash ()); |
382 } | 382 } |
383 } | 383 } |
384 stop = clock (); | 384 stop = clock (); |
385 Report ("hash", stop - start); | 385 Report ("hash", stop - start); |
386 ·· | 386 ·· |
387 } | 387 } |
388 | 388 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 TypeIdPerformanceSuite (); | 448 TypeIdPerformanceSuite (); |
449 }; | 449 }; |
450 ·· | 450 ·· |
451 TypeIdPerformanceSuite::TypeIdPerformanceSuite () | 451 TypeIdPerformanceSuite::TypeIdPerformanceSuite () |
452 : TestSuite ("type-id-perf", PERFORMANCE) | 452 : TestSuite ("type-id-perf", PERFORMANCE) |
453 { | 453 { |
454 AddTestCase (new LookupTimeTestCase, QUICK); | 454 AddTestCase (new LookupTimeTestCase, QUICK); |
455 } | 455 } |
456 | 456 |
457 static TypeIdPerformanceSuite g_TypeIdPerformanceSuite; | 457 static TypeIdPerformanceSuite g_TypeIdPerformanceSuite; |
LEFT | RIGHT |