No flags found
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
0cb93dd
... +1 ...
8efe43a
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
482 | 482 | void sendDisconnect(); |
|
483 | 483 | /** broadcast a message to all federates*/ |
|
484 | 484 | void broadcastToFederates(ActionMessage& cmd); |
|
485 | - | ||
485 | + | /** generate a counter for when to reset object*/ |
|
486 | + | int generateMapObjectCounter() const; |
|
486 | 487 | friend class TimeoutMonitor; |
|
487 | 488 | }; |
|
488 | 489 |
2075 | 2075 | { |
|
2076 | 2076 | if ((queryStr == "queries") || (queryStr == "available_queries")) { |
|
2077 | 2077 | return "[isinit;isconnected;exists;name;identifier;address;queries;address;federates;inputs;endpoints;filtered_endpoints;" |
|
2078 | - | "publications;filters;version;version_all;federate_map;dependency_graph;data_flow_graph;dependencies;dependson;dependents;current_time;global_time;global_state;current_state]"; |
|
2078 | + | "publications;filters;version;version_all;counter;federate_map;dependency_graph;data_flow_graph;dependencies;dependson;dependents;current_time;global_time;global_state;current_state]"; |
|
2079 | 2079 | } |
|
2080 | 2080 | if (queryStr == "isconnected") { |
|
2081 | 2081 | return (isConnected()) ? "true" : "false"; |
2249 | 2249 | if (queryStr == "address") { |
|
2250 | 2250 | return getAddress(); |
|
2251 | 2251 | } |
|
2252 | + | if (queryStr == "counter") { |
|
2253 | + | return fmt::format("{}", generateMapObjectCounter()); |
|
2254 | + | } |
|
2252 | 2255 | if (queryStr == "filtered_endpoints") { |
|
2253 | 2256 | return filteredEndpointQuery(nullptr); |
|
2254 | 2257 | } |
2277 | 2280 | if (mi != mapIndex.end()) { |
|
2278 | 2281 | auto index = mi->second.first; |
|
2279 | 2282 | if (isValidIndex(index, mapBuilders) && !mi->second.second) { |
|
2280 | - | if (std::get<0>(mapBuilders[index]).isCompleted()) { |
|
2281 | - | return std::get<0>(mapBuilders[index]).generate(); |
|
2283 | + | auto& builder = std::get<0>(mapBuilders[index]); |
|
2284 | + | if (builder.isCompleted()) { |
|
2285 | + | auto center = generateMapObjectCounter(); |
|
2286 | + | if (center == builder.getCounterCode()) { |
|
2287 | + | return builder.generate(); |
|
2288 | + | } |
|
2289 | + | builder.reset(); |
|
2282 | 2290 | } |
|
2283 | - | if (std::get<0>(mapBuilders[index]).isActive()) { |
|
2291 | + | if (builder.isActive()) { |
|
2284 | 2292 | return "#wait"; |
|
2285 | 2293 | } |
|
2286 | 2294 | } |
|
2287 | 2295 | ||
2288 | 2296 | initializeMapBuilder(queryStr, index, mi->second.second); |
|
2289 | 2297 | if (std::get<0>(mapBuilders[index]).isCompleted()) { |
|
2298 | + | if (!mi->second.second) { |
|
2299 | + | auto center = generateMapObjectCounter(); |
|
2300 | + | std::get<0>(mapBuilders[index]).setCounterCode(center); |
|
2301 | + | } |
|
2290 | 2302 | return std::get<0>(mapBuilders[index]).generate(); |
|
2291 | 2303 | } |
|
2292 | 2304 | return "#wait"; |
2605 | 2617 | ||
2606 | 2618 | } break; |
|
2607 | 2619 | case CMD_QUERY_REPLY: |
|
2608 | - | if (command.dest_id == global_broker_id_local) { |
|
2620 | + | if (command.dest_id == global_broker_id_local || command.dest_id == direct_core_id) { |
|
2609 | 2621 | processQueryResponse(command); |
|
2610 | 2622 | } else { |
|
2611 | 2623 | transmit(getRoute(command.dest_id), command); |
3634 | 3646 | requestors.clear(); |
|
3635 | 3647 | if (std::get<2>(mapBuilders[m.counter])) { |
|
3636 | 3648 | builder.reset(); |
|
3649 | + | } else { |
|
3650 | + | builder.setCounterCode(generateMapObjectCounter()); |
|
3637 | 3651 | } |
|
3638 | 3652 | } |
|
3639 | 3653 | } |
3968 | 3982 | return false; |
|
3969 | 3983 | } |
|
3970 | 3984 | ||
3985 | + | int CommonCore::generateMapObjectCounter() const |
|
3986 | + | { |
|
3987 | + | int result = static_cast<int>(brokerState.load()); |
|
3988 | + | for (const auto& fed : loopFederates) { |
|
3989 | + | result += static_cast<int>(fed.state); |
|
3990 | + | } |
|
3991 | + | result += static_cast<int>(loopHandles.size()); |
|
3992 | + | return result; |
|
3993 | + | } |
|
3994 | + | ||
3971 | 3995 | void CommonCore::sendDisconnect() |
|
3972 | 3996 | { |
|
3973 | 3997 | LOG_CONNECTIONS(global_broker_id_local, "core", "sending disconnect"); |
21 | 21 | private: |
|
22 | 22 | std::unique_ptr<Json::Value> jMap; |
|
23 | 23 | std::map<int, std::pair<std::string, int32_t>> missing_components; |
|
24 | - | ||
24 | + | int counterCode{0}; // a code for the user to include for various purposes |
|
25 | 25 | public: |
|
26 | 26 | JsonMapBuilder() noexcept; |
|
27 | 27 | ~JsonMapBuilder(); |
47 | 47 | std::string generate(); |
|
48 | 48 | /** reset the builder*/ |
|
49 | 49 | void reset(); |
|
50 | + | /** set the counter code value*/ |
|
51 | + | void setCounterCode(int code) { counterCode = code; } |
|
52 | + | int getCounterCode() const { return counterCode; } |
|
50 | 53 | }; |
|
51 | 54 | ||
52 | 55 | /** class to help with the generation of JSON*/ |
483 | 483 | std::string TimeCoordinator::printTimeStatus() const |
|
484 | 484 | { |
|
485 | 485 | return fmt::format( |
|
486 | - | R"raw({{"granted_time":{}, "exec":{}, "allow":{}, "value":{}, "message":{}, "minDe":{}, "minminDe":{}}})raw", |
|
486 | + | R"raw({{"granted_time":{},"requested_time":{}, "exec":{}, "allow":{}, "value":{}, "message":{}, "minDe":{}, "minminDe":{}}})raw", |
|
487 | 487 | static_cast<double>(time_granted), |
|
488 | + | static_cast<double>(time_requested), |
|
488 | 489 | static_cast<double>(time_exec), |
|
489 | 490 | static_cast<double>(time_allow), |
|
490 | 491 | static_cast<double>(time_value), |
Learn more Showing 14 files with coverage changes found.
src/helics/network/ipc/IpcQueueHelper.cpp
src/helics/network/CommsInterface.cpp
src/helics/core/TimeDependencies.cpp
src/helics/network/NetworkCommsInterface.cpp
src/helics/core/ActionMessage.cpp
src/helics/core/CoreBroker.cpp
src/helics/core/TimeCoordinator.cpp
src/helics/core/CommonCore.cpp
src/helics/core/BrokerBase.cpp
src/helics/network/zmq/ZmqCommsSS.cpp
src/helics/network/test/TestComms.cpp
src/helics/apps/helicsWebServer.cpp
src/helics/core/CoreFactory.cpp
src/helics/network/zmq/ZmqComms.cpp
Files | Coverage |
---|---|
src/helics | 0.07% 76.96% |
Project Totals (210 files) | 76.96% |
8efe43a
9329f26
0cb93dd