COSMOS core  1.0.2 (beta)
Comprehensive Open-architecture Solution for Mission Operations Systems
cosmos_size.cpp File Reference
Include dependency graph for cosmos_size.cpp:

Functions

int main (int argc, char *argv[])
 

Function Documentation

int main ( int  argc,
char *  argv[] 
)
34 {
35  Agent *myagent;
36 
37  myagent = new Agent();
38  string node ="";
39  if (argc == 2)
40  {
41  node = argv[1];
42  }
43  json_setup_node(node, myagent->cinfo);
44 
45  size_t total = 0;
46  size_t count = 0;
47 
48  total += COSMOS_SIZEOF(nodestruc);
49  printf("Node: %lu : %lu\n", COSMOS_SIZEOF(nodestruc), total);
50 
51  count = 0;
52  for (size_t i=0; i<myagent->cinfo->pieces.size(); ++i)
53  {
54  ++count;
55  total += COSMOS_SIZEOF(piecestruc);
56  }
57  printf("Pieces: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(piecestruc), count*COSMOS_SIZEOF(piecestruc), total);
58 
59  count = 0;
60  for (size_t i=0; i<myagent->cinfo->device.size(); ++i)
61  {
62  ++count;
63  total += COSMOS_SIZEOF(devicestruc);
64  }
65  printf("Devices: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(devicestruc), count*COSMOS_SIZEOF(devicestruc), total);
66 
67  total += COSMOS_SIZEOF(devspecstruc);
68  printf("Device Special: %ld : %lu\n", COSMOS_SIZEOF(devspecstruc), total);
69 
70  count = 0;
71  for (size_t i=0; i<myagent->cinfo->port.size(); ++i)
72  {
73  ++count;
74  total += COSMOS_SIZEOF(portstruc);
75  }
76  printf("Ports: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(portstruc), count*COSMOS_SIZEOF(portstruc), total);
77 
78  total += COSMOS_SIZEOF(physicsstruc);
79  printf("Physics: %ld : %lu\n", COSMOS_SIZEOF(physicsstruc), total);
80 
81  count = 0;
82  for (size_t i=0; i<myagent->cinfo->agent.size(); ++i)
83  {
84  ++count;
85  total += COSMOS_SIZEOF(agentstruc);
86  }
87  printf("Agents: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(agentstruc), count*COSMOS_SIZEOF(agentstruc), total);
88 
89  count = 0;
90  for (size_t i=0; i<myagent->cinfo->target.size(); ++i)
91  {
92  ++count;
93  total += COSMOS_SIZEOF(targetstruc);
94  }
95  printf("Targets: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(targetstruc), count*COSMOS_SIZEOF(targetstruc), total);
96 
97  count = 0;
98  for (size_t i=0; i<myagent->cinfo->user.size(); ++i)
99  {
100  ++count;
101  total += COSMOS_SIZEOF(userstruc);
102  }
103  printf("Users: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(userstruc), count*COSMOS_SIZEOF(userstruc), total);
104 
105  count = 0;
106  for (size_t i=0; i<myagent->cinfo->tle.size(); ++i)
107  {
108  ++count;
109  total += COSMOS_SIZEOF(tlestruc);
110  }
111  printf("TLEs: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(tlestruc), count*COSMOS_SIZEOF(tlestruc), total);
112 
113  printf("Total for pdata: %lu\n\n", total);
114 
115  total = 0;
116  count = 0;
117 
118  total += COSMOS_SIZEOF(nodestruc);
119  printf("Node: %ld : %lu\n", COSMOS_SIZEOF(nodestruc), total);
120 
121  count = 0;
122  for (size_t i=0; i<myagent->cinfo->pieces.size(); ++i)
123  {
124  ++count;
125  total += COSMOS_SIZEOF(piecestruc);
126  }
127  printf("Pieces: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(piecestruc), count*COSMOS_SIZEOF(piecestruc), total);
128 
129  count = 0;
130  for (size_t i=0; i<myagent->cinfo->device.size(); ++i)
131  {
132  ++count;
133  total += COSMOS_SIZEOF(devicestruc);
134  }
135  printf("Devices: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(devicestruc), count*COSMOS_SIZEOF(devicestruc), total);
136 
137  total += COSMOS_SIZEOF(devspecstruc);
138  printf("Device Special: %ld : %lu\n", COSMOS_SIZEOF(devspecstruc), total);
139 
140  count = 0;
141  for (size_t i=0; i<myagent->cinfo->port.size(); ++i)
142  {
143  ++count;
144  total += COSMOS_SIZEOF(portstruc);
145  }
146  printf("Ports: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(portstruc), count*COSMOS_SIZEOF(portstruc), total);
147 
148  total += COSMOS_SIZEOF(physicsstruc);
149  printf("Physics: %ld : %lu\n", COSMOS_SIZEOF(physicsstruc), total);
150 
151  count = 0;
152  for (size_t i=0; i<myagent->cinfo->agent.size(); ++i)
153  {
154  ++count;
155  total += COSMOS_SIZEOF(agentstruc);
156  }
157  printf("Agents: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(agentstruc), count*COSMOS_SIZEOF(agentstruc), total);
158 
159  count = 0;
160  for (size_t i=0; i<myagent->cinfo->target.size(); ++i)
161  {
162  ++count;
163  total += COSMOS_SIZEOF(targetstruc);
164  }
165  printf("Targets: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(targetstruc), count*COSMOS_SIZEOF(targetstruc), total);
166 
167  count = 0;
168  for (size_t i=0; i<myagent->cinfo->user.size(); ++i)
169  {
170  ++count;
171  total += COSMOS_SIZEOF(userstruc);
172  }
173  printf("Users: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(userstruc), count*COSMOS_SIZEOF(userstruc), total);
174 
175  count = 0;
176  for (size_t i=0; i<myagent->cinfo->tle.size(); ++i)
177  {
178  ++count;
179  total += COSMOS_SIZEOF(tlestruc);
180  }
181  printf("TLEs: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(tlestruc), count*COSMOS_SIZEOF(tlestruc), total);
182 
183  printf("Total for sdata: %lu\n\n", total);
184 
185  total = 0;
186  count = 0;
187  for (size_t i=0; i<myagent->cinfo->jmap.size(); ++i)
188  {
189  for (size_t j=0; j<myagent->cinfo->jmap[j].size(); ++j)
190  {
191  ++count;
192  total += COSMOS_SIZEOF(jsonentry);
193  }
194  }
195  printf("Jmap: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(jsonentry), count*COSMOS_SIZEOF(jsonentry), total);
196 
197  count = 0;
198  for (size_t i=0; i<myagent->cinfo->emap.size(); ++i)
199  {
200  for (size_t j=0; j<myagent->cinfo->emap[j].size(); ++j)
201  {
202  ++count;
203  total += COSMOS_SIZEOF(jsonequation);
204  }
205  }
206  printf("Emap: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(jsonequation), count*COSMOS_SIZEOF(jsonequation), total);
207 
208  count = 0;
209  for (size_t i=0; i<myagent->cinfo->unit.size(); ++i)
210  {
211  for (size_t j=0; j<myagent->cinfo->unit[j].size(); ++j)
212  {
213  ++count;
214  total += COSMOS_SIZEOF(jsonequation);
215  }
216  }
217  printf("Units: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(unitstruc), count*COSMOS_SIZEOF(unitstruc), total);
218 
219  count = 0;
220  for (size_t i=0; i<myagent->cinfo->equation.size(); ++i)
221  {
222  ++count;
223  total += COSMOS_SIZEOF(equationstruc);
224  }
225  printf("Equations: %lu x %ld = %lu : %lu\n", count, COSMOS_SIZEOF(equationstruc), count*COSMOS_SIZEOF(equationstruc), total);
226 
227  printf("Total for meta: %lu\n\n", total);
228 
229  fflush(stdout);
230 }
vector< portstruc > port
Vector of all ports known to node.
Definition: jsondef.h:4244
vector< tlestruc > tle
Array of Two Line Elements.
Definition: jsondef.h:4259
Device structure.
Definition: jsondef.h:3692
In units for the SGP4 propogator (not NORAD TLE itself).
Definition: convertdef.h:921
Target structure.
Definition: jsondef.h:1290
int32_t json_setup_node(jsonnode json, cosmosstruc *cinfo, bool create_flag)
Setup JSON Namespace using Node description JSON.
Definition: jsonlib.cpp:6869
#define COSMOS_SIZEOF(element)
Definition: configCosmos.h:139
int i
Definition: rw_test.cpp:37
int count
Definition: rw_test.cpp:36
Equation structure.
Definition: jsondef.h:1249
vector< vector< jsonequation > > emap
JSON Equation Map matrix.
Definition: jsondef.h:4211
Part structure: physical information for each piece of Node.
Definition: jsondef.h:1446
Definition: jsondef.h:1199
vector< vector< unitstruc > > unit
JSON Unit Map matrix: first level is for unit type, second level is for all variants (starting with p...
Definition: jsondef.h:4214
Physics Simulation Structure.
Definition: jsondef.h:3411
vector< devicestruc > device
Vector of all general (common) information for devices (components) in node.
Definition: jsondef.h:4238
vector< equationstruc > equation
Vector of Equations.
Definition: jsondef.h:4217
JSON map offset entry.
Definition: jsondef.h:4164
Definition: agentclass.h:139
vector< userstruc > user
Single entry vector for user information.
Definition: jsondef.h:4256
Port structure.
Definition: jsondef.h:1357
JSON equation entry.
Definition: jsondef.h:865
Agent control structure.
Definition: jsondef.h:1006
vector< agentstruc > agent
Single entry vector for agent information.
Definition: jsondef.h:4247
vector< piecestruc > pieces
Vector of all pieces in node.
Definition: jsondef.h:4232
cosmosstruc * cinfo
Definition: agentclass.h:346
int myagent()
Definition: agent_add_soh.cpp:96
Definition: jsondef.h:3553
Specific Device structure.
Definition: jsondef.h:3860
JSON unit type entry.
Definition: jsondef.h:672
vector< vector< jsonentry > > jmap
JSON Namespace Map matrix. first entry hash, second is items with that hash.
Definition: jsondef.h:4208
vector< targetstruc > target
Vector of all targets known to node.
Definition: jsondef.h:4253
static string node
Definition: agent_monitor.cpp:126