F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
TlmChanImplCfg.hpp
Go to the documentation of this file.
1 
13 #ifndef TLMCHANIMPLCFG_HPP_
14 #define TLMCHANIMPLCFG_HPP_
15 
16 // Anonymous namespace for configuration parameters
17 
18 
19 // The parameters below provide for tuning of the hash function used to
20 // write and read entries in the database. The has function is very simple;
21 // It first takes the telemetry ID and does a modulo computation with
22 // TLMCHAN_HASH_MOD_VALUE. It then does a second modulo with the number
23 // of slots to make sure the value lands in the provided slots.
24 // The values can be experimented with to try and balance the number
25 // of slots versus the number of buckets.
26 // To test the set of telemetry ID in the system to see if the hash is
27 // balanced, do the following:
28 // 1) From the deployment directory (e.g Ref), do a full build then type:
29 // "make comp_report_gen"
30 // This will generate a list in "<deployment dir>/ComponentReport.txt"
31 // with all the telemetry IDs in the deployment.
32 // 2) Cut and paste the ID list to the array declared in the TlmChan unit test
33 // file TelemChanImplTester.cpp in the runMultiChannel() method.
34 // 3) Run the unit test ("make ut run_ut")
35 // 4) After writing all the telemetry IDs to the component, the
36 // unit test will dump the hash table. The output looks like the following:
37 // Slot: <n> - slot number
38 // Entry - a bucket assigned to the slot
39 // ... (Other buckets in the slot)
40 // The number of buckets assigned to each slot can be checked for balance.
41 
42 namespace {
43 
44  enum {
45  TLMCHAN_NUM_TLM_HASH_SLOTS = 15, // !< Number of slots in the hash table.
46  // Works best when set to about twice the number of components producing telemetry
47  TLMCHAN_HASH_MOD_VALUE = 99, // !< The modulo value of the hashing function.
48  // Should be set to a little below the ID gaps to spread the entries around
49 
50  TLMCHAN_HASH_BUCKETS = 500 // !< Buckets assignable to a hash slot.
51  // Buckets must be >= number of telemetry channels in system
52  };
53 
54 
55 }
56 
57 #endif /* TLMCHANIMPLCFG_HPP_ */