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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 class TypeIdTestSuite : public TestSuite | 421 class TypeIdTestSuite : public TestSuite |
422 { | 422 { |
423 public: | 423 public: |
424 TypeIdTestSuite (); | 424 TypeIdTestSuite (); |
425 }; | 425 }; |
426 ·· | 426 ·· |
427 TypeIdTestSuite::TypeIdTestSuite () | 427 TypeIdTestSuite::TypeIdTestSuite () |
428 : TestSuite ("type-id", UNIT) | 428 : TestSuite ("type-id", UNIT) |
429 { | 429 { |
430 // Turn on logging, so we see the result of collisions | 430 // Turn on logging, so we see the result of collisions |
431 LogComponentEnable ("TypeId", ns3::LogLevel(LOG_ERROR|LOG_PREFIX_FUNC)); | 431 #if 0 |
432 ·· | 432 LogComponentEnable ("TypeId", ns3::LogLevel(LOG_ERROR|LOG_PREFIX_FUNC)); |
| 433 #endif |
| 434 |
433 // If the CollisionTestCase is performed before the | 435 // If the CollisionTestCase is performed before the |
434 // UniqueIdTestCase, the artificial collisions added by | 436 // UniqueIdTestCase, the artificial collisions added by |
435 // CollisionTestCase will show up in the list of TypeIds | 437 // CollisionTestCase will show up in the list of TypeIds |
436 // as chained. | 438 // as chained. |
437 AddTestCase (new UniqueTypeIdTestCase, QUICK); | 439 AddTestCase (new UniqueTypeIdTestCase, QUICK); |
438 AddTestCase (new CollisionTestCase, QUICK); | 440 AddTestCase (new CollisionTestCase, QUICK); |
439 AddTestCase (new DeprecatedAttributeTestCase, QUICK); | 441 AddTestCase (new DeprecatedAttributeTestCase, QUICK); |
440 } | 442 } |
441 | 443 |
442 static TypeIdTestSuite g_TypeIdTestSuite;·· | 444 static TypeIdTestSuite g_TypeIdTestSuite;·· |
443 ·· | 445 ·· |
444 | 446 |
445 class TypeIdPerformanceSuite : public TestSuite | 447 class TypeIdPerformanceSuite : public TestSuite |
446 { | 448 { |
447 public: | 449 public: |
448 TypeIdPerformanceSuite (); | 450 TypeIdPerformanceSuite (); |
449 }; | 451 }; |
450 ·· | 452 ·· |
451 TypeIdPerformanceSuite::TypeIdPerformanceSuite () | 453 TypeIdPerformanceSuite::TypeIdPerformanceSuite () |
452 : TestSuite ("type-id-perf", PERFORMANCE) | 454 : TestSuite ("type-id-perf", PERFORMANCE) |
453 { | 455 { |
454 AddTestCase (new LookupTimeTestCase, QUICK); | 456 AddTestCase (new LookupTimeTestCase, QUICK); |
455 } | 457 } |
456 | 458 |
457 static TypeIdPerformanceSuite g_TypeIdPerformanceSuite; | 459 static TypeIdPerformanceSuite g_TypeIdPerformanceSuite; |
LEFT | RIGHT |