diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e33609d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.png diff --git a/design/circular_buffer_allocator_acquireslottowrite.puml b/design/circular_buffer_allocator_acquireslottowrite.puml new file mode 100644 index 0000000..17bda45 --- /dev/null +++ b/design/circular_buffer_allocator_acquireslottowrite.puml @@ -0,0 +1,19 @@ +@startuml circular_buffer_allocator_acquireslottowrite +title Circular Buffer Allocator Acquire Slot To Write +start +:Loop Counter = 0; +repeat :Increment loop counter; + :Atomically + Get slot + Increment next slot index; + :Slot index = claimed slot % circular buffer capacity; + if (Loop counter > circular buffer size) then (Yes) + :Return empty; + stop + else (No) + endif +repeat while (Slot in use?) is (Yes) not (No); +:Mark Slot as in use; +:Return Slot index; +stop +@enduml diff --git a/design/circular_buffer_allocator_acquireslottowrite.uxf b/design/circular_buffer_allocator_acquireslottowrite.uxf deleted file mode 100644 index d085497..0000000 --- a/design/circular_buffer_allocator_acquireslottowrite.uxf +++ /dev/null @@ -1,15 +0,0 @@ -10Return slot indexUMLSpecialState240402020type=initialRelation240503060lt=<-10;40;10;10Relation2401203070lt=<-10;50;10;10UMLState14017022040Increment loop counterUMLSpecialState120310260100Loop counter > circular buffer size -bg=red -type=decisionRelation2402703060lt=<-10;40;10;10UMLState14024022040Increment claimed slotRelation2402003060lt=<-10;40;10;10Relation70350180470lt=<- -m2=[Yes]160;450;160;420;30;420;30;10;50;10Relation2404005060lt=<- -[No]10;40;10;10Relation2404703060lt=<-10;40;10;10UMLSpecialState2408302020type=final -UMLState1409022040Loop counter = 0UMLState14044022040Slot index = claimed slot % circular -buffer capacityUMLSpecialState120510260100Circular buffer at Slot index in use? -bg=red -type=decisionUMLState14064022040Mark Slot as in useUMLState14071022040Return Slot indexRelation2406005060lt=<- -[No]10;40;10;10Relation2406703060lt=<-10;40;10;10Relation2407403080lt=<-10;60;10;10Relation240140200450lt=<- -m2=[Yes]10;10;170;10;170;420;140;420UMLObject700370870CircularAllocator::AcquireSlotToWrite -valign=topUMLSyncBarHorizontal2107908020lw=5 -Relation2407903060lt=->10;10;10;40Text1808206040Finish -halign=center -style=autoresize \ No newline at end of file diff --git a/design/configuration_sequence.puml b/design/configuration_sequence.puml new file mode 100644 index 0000000..37f7a0b --- /dev/null +++ b/design/configuration_sequence.puml @@ -0,0 +1,113 @@ +@startuml configuration_sequence +title Configuration Sequence + +participant "App" as App +participant "Logger" as LOG +participant "LogStreamFactory" as LSF +participant "Runtime" as RT +participant "RecorderFactory" as RF +participant "TargetConfigReader" as TCR +participant "ConfigurationFileDiscoverer" as CFD +participant "JSON" as JSON +participant "OS" as OS + +activate App + +App -> LOG **: CreateLogger(...) +activate LOG + +App -> LOG: LogError() + +LOG -> LSF: GetStream(LogLevel) + +LSF -> RT: GetRecorder() + +alt Runtime instance has not been created + RT -> RT: Constructor + activate RT +end + +RT -> RF **: CreateRecorderFactory() + +activate RF + +RT -> RF: CreateFromConfiguration() + + +RF -> CFD **: make_unique(...) +activate CFD + +RF -> TCR **: make_unique(ConfigurationFileDiscoverer) +activate TCR + + +RF -> TCR: ReadConfig() + +TCR -> CFD: FindConfigurationFiles() + +note right of CFD + Find and return the existing + config files. +end note + +CFD -> OS: access(/etc/ecu_logging_config.json) +alt MW_LOG_CONFIG_FILE is defined + CFD -> OS: access(MW_LOG_CONFIG_FILE) +else MW_LOG_CONFIG_FILE is undefined + CFD -> OS: access(/etc/logging.json) + CFD -> OS: access(/logging.json) + CFD -> OS: access(/../etc/logging.json) +end + +CFD -> TCR: Return global and environmental or application config file paths. + +TCR -> JSON: FromFile(global_file_path) +JSON -> TCR: + +alt MW_LOG_CONFIG_FILE is defined + TCR -> JSON: FromFile() + JSON -> TCR: +else MW_LOG_CONFIG_FILE is undefined + TCR -> JSON: FromFile() + JSON -> TCR: +end + +note right of TCR + Overwrite global configiuration + with environmental or application config file paths. +end note + +TCR -> RF: Return Configuration instance + +group Possibilities + +note right of RF + For exmple, kRemote and kConsole + requested in configuration. +end note + +Create "DatarouterRecorder" as DR + +RF -> DR: Create instance with configuration + +Create "TextRecorder" as TR + +RF -> TR: Create instance with configuration + +Create "CompositeRecorder" as CR + +RF -> CR: Create with Datarouter and StandardOut recorders +note right of CR + Composite Recorder will + forward the logs to DatarouterRecorder + and TextRecorder +end note + +end + +RF -> RT: Store returned instance + +RT -> LSF +LSF -> LOG: Return Recorder instance + +@enduml diff --git a/design/configuration_sequence.uxf b/design/configuration_sequence.uxf deleted file mode 100644 index 39251a6..0000000 --- a/design/configuration_sequence.uxf +++ /dev/null @@ -1,677 +0,0 @@ - - - 10 - - UMLGeneric - - 60 - 50 - 20 - 1140 - - - - - - Relation - - 60 - 30 - 30 - 40 - - lt=. - 10.0;10.0;10.0;20.0 - - - UMLGeneric - - 20 - 10 - 100 - 30 - - _:App_ - - - - UMLGeneric - - 260 - 10 - 160 - 30 - - FreeFunctions - - - - Relation - - 70 - 50 - 290 - 40 - - lt=<- -bmw::mw::log::Error() - 270.0;20.0;10.0;20.0 - - - Relation - - 330 - 30 - 30 - 1170 - - lt=. - 10.0;10.0;10.0;1150.0 - - - Relation - - 330 - 100 - 250 - 40 - - lt=<- -GetStream(LogLevel) - 230.0;20.0;10.0;20.0 - - - UMLGeneric - - 490 - 10 - 160 - 30 - - LogStreamFactory - - - - Relation - - 570 - 120 - 230 - 40 - - lt=<- -GetRecorder() - 210.0;20.0;10.0;20.0 - - - UMLGeneric - - 560 - 100 - 20 - 1080 - - - - - - UMLGeneric - - 700 - 10 - 160 - 30 - - Runtime - - - - - Relation - - 770 - 30 - 30 - 1160 - - lt=. - 10.0;10.0;10.0;1140.0 - - - Relation - - 770 - 130 - 240 - 40 - - lt=<- -CreateForTarget() - 220.0;20.0;10.0;20.0 - - - UMLGeneric - - 920 - 10 - 160 - 30 - - RecorderFactory - - - - - UMLGeneric - - 1160 - 10 - 160 - 30 - - TargetConfigReader - - - - - Relation - - 980 - 30 - 30 - 1160 - - lt=. - 10.0;10.0;10.0;1140.0 - - - UMLGeneric - - 1400 - 10 - 180 - 30 - - ConfigurationFileDiscoverer - - - - - Relation - - 1230 - 30 - 30 - 870 - - lt=. - 10.0;10.0;10.0;850.0 - - - Relation - - 980 - 170 - 280 - 40 - - lt=<- -ReadConfig() - 260.0;20.0;10.0;20.0 - - - UMLGeneric - - 1640 - 10 - 180 - 30 - - bmw::json - - - - - Relation - - 1480 - 30 - 30 - 630 - - lt=. - 10.0;10.0;10.0;610.0 - - - Relation - - 1230 - 210 - 280 - 40 - - lt=<- -FindConfigurationFiles() - 260.0;20.0;10.0;20.0 - - - Relation - - 1720 - 30 - 30 - 800 - - lt=. - 10.0;10.0;10.0;780.0 - - - UMLGeneric - - 1880 - 10 - 180 - 30 - - bmw::os - - - - - Relation - - 1950 - 30 - 30 - 540 - - lt=. - 10.0;10.0;10.0;520.0 - - - Relation - - 1480 - 240 - 500 - 40 - - lt=<- -access(/etc/ecu_logging_config.json) - 480.0;20.0;10.0;20.0 - - - Relation - - 1480 - 480 - 500 - 40 - - lt=<- -access(<binary path>/../etc/logging.json) - 480.0;20.0;10.0;20.0 - - - Relation - - 1220 - 550 - 300 - 50 - - lt=<- -Return global and environmental or application -config file paths. - 20.0;20.0;270.0;20.0 - - - Relation - - 1230 - 590 - 520 - 40 - - lt=<- -bmw::json::FromFile(<global file path>) - 500.0;20.0;10.0;20.0 - - - Relation - - 1230 - 750 - 520 - 40 - - lt=<- -bmw::json::FromFile(<app file path>) - 500.0;20.0;10.0;20.0 - - - Relation - - 980 - 840 - 280 - 50 - - lt=<- -Return Configuration -instance - 10.0;20.0;260.0;20.0 - - - UMLGeneric - - 1150 - 910 - 180 - 30 - - DatarouterRecorder - - - - - UMLGeneric - - 1410 - 910 - 180 - 30 - - TextRecorder - - - - - UMLGeneric - - 1630 - 910 - 180 - 30 - - CompositeRecorder - - - - - Relation - - 1230 - 930 - 30 - 110 - - lt=. - 10.0;10.0;10.0;90.0 - - - UMLNote - - 1240 - 800 - 200 - 50 - - Overwrite global configuration -with environmental or application configuration. -bg=yellow - - - - Relation - - 1480 - 930 - 30 - 150 - - lt=. - 10.0;10.0;10.0;130.0 - - - Relation - - 980 - 980 - 280 - 50 - - lt=<- -Create instance of -with configuration - 260.0;20.0;10.0;20.0 - - - Relation - - 980 - 1020 - 530 - 50 - - lt=<- -Create instance of -with configuration - 510.0;20.0;10.0;20.0 - - - Relation - - 1720 - 930 - 30 - 230 - - lt=. - 10.0;10.0;10.0;210.0 - - - Relation - - 770 - 1130 - 240 - 40 - - lt=<- -Stores returned instance - 10.0;20.0;220.0;20.0 - - - Relation - - 570 - 1140 - 230 - 40 - - lt=<- -Returns Recorder instance - 10.0;20.0;210.0;20.0 - - - UMLNote - - 880 - 910 - 240 - 50 - - For example, kRemote and kConsole -requested in configuration. -bg=yellow - - - - UMLNote - - 90 - 90 - 240 - 130 - - If a user wants to avoid the latency -on the first log message, we provide -`mw::log::Initialize()` that shall -take care of initializing the runtime. -If this method is called, the first -log message will directly use the -initialized recorders. -bg=yellow - - - - UMLNote - - 1500 - 190 - 200 - 50 - - Find and return the existing -config files. -bg=yellow - - - - UMLNote - - 1740 - 970 - 260 - 60 - - Composite Recorder will -forward the logs to DatarouterRecorder -and TextRecorder -bg=yellow - - - - UMLNote - - 640 - 180 - 190 - 50 - - If no recorder exists yet, -create one using the factory. -bg=yellow - - - - Relation - - 1480 - 320 - 500 - 40 - - lt=<- -access(MW_LOG_CONFIG_FILE) - 480.0;20.0;10.0;20.0 - - - Relation - - 1480 - 440 - 500 - 40 - - lt=<- -access(<cwd>/logging.json) - 480.0;20.0;10.0;20.0 - - - Relation - - 1480 - 390 - 500 - 40 - - lt=<- -access(<cwd>/etc/logging.json) - 480.0;20.0;10.0;20.0 - - - UMLFrame - - 1390 - 280 - 670 - 250 - - Alternative --- -MW_LOG_CONFIG_FILE is defined - - - --- -MW_LOG_CONFIG_FILE is undefined - - - - UMLFrame - - 1180 - 640 - 610 - 150 - - Alternative --- -MW_LOG_CONFIG_FILE is defined - - - --- -MW_LOG_CONFIG_FILE is undefined - - - - Relation - - 1230 - 680 - 520 - 40 - - lt=<- -bmw::json::FromFile(<environmental file path>) - 500.0;20.0;10.0;20.0 - - - UMLFrame - - 860 - 880 - 1200 - 250 - - Possibilities --- - - - - - Relation - - 980 - 1080 - 770 - 40 - - lt=<- -Create with Datarouter and StandardOut recorders - 750.0;20.0;10.0;20.0 - - diff --git a/design/configuration_use_cases.puml b/design/configuration_use_cases.puml new file mode 100644 index 0000000..bc0a009 --- /dev/null +++ b/design/configuration_use_cases.puml @@ -0,0 +1,26 @@ +@startuml configuration_use_cases +left to right direction +title Configuration Use Cases + +actor "Developer\nDebug application\ndeployed on target" as Dev1 + +actor "Developer,\nUnit testing" as Dev2 +actor "Performance\nEngineer" as PerfEng + +usecase "ECU wide configuration\n--\nECUID = MPP1\nLogLevel = kError" as UC1_ECU +usecase "Application configuration\n--\nAPPID = Para\nLogMode = kRemote | kConsole\nLogLevel = kDebug" as UC1_App + +usecase "Print the logs on the console for\nanalysis of unit test failures." as UC2_Console +usecase "No logging.json files" as UC2_Default + +usecase "Disable logging completely\nMeasure performance impact of logging" as UC3_Performance + +Dev1 --> UC1_ECU : "Use case 1" +Dev1 --> UC1_App : "Use case 1" + +Dev2 --> UC2_Console : "Use case 2" +Dev2 --> UC2_Default : "Use case 2" + +PerfEng --> UC3_Performance : "Use case 3" + +@enduml diff --git a/design/configuration_use_cases.uxf b/design/configuration_use_cases.uxf deleted file mode 100644 index 13ecc00..0000000 --- a/design/configuration_use_cases.uxf +++ /dev/null @@ -1,194 +0,0 @@ - - - 10 - - UMLActor - - 130 - 90 - 260 - 120 - - Developer, -Debug Application deployed on target - - - - UMLUseCase - - 470 - 140 - 250 - 90 - - Application configuration --- -APPID = Para -LogMode = kRemote | kConsole -LogLevel = kDebug -valign=top - - - - UMLUseCase - - 490 - 30 - 210 - 90 - - ECU wide configuration --- -ECUID = MPP1 -LogLevel = kError -valign=top - - - - Relation - - 350 - 60 - 160 - 130 - - lt=->> - 10.0;110.0;140.0;10.0 - - - Relation - - 350 - 160 - 150 - 30 - - lt=->> - 10.0;10.0;130.0;10.0 - - - UMLActor - - 210 - 300 - 100 - 120 - - Developer, -Unit testing - - - - UMLUseCase - - 380 - 300 - 340 - 50 - - Print the logs on the console for -analysis of unit test failures. - - - - UMLUseCase - - 80 - 50 - 120 - 40 - - Use case 1 - - - - UMLUseCase - - 80 - 290 - 120 - 40 - - Use case 2 - - - - UMLUseCase - - 80 - 470 - 120 - 40 - - Use case 3 - - - - UMLUseCase - - 380 - 370 - 340 - 40 - - No logging.json files, it should just work (tm). - - - - Relation - - 280 - 320 - 120 - 90 - - lt=->> - 10.0;10.0;100.0;70.0 - - - Relation - - 280 - 310 - 120 - 40 - - lt=->> - 10.0;20.0;100.0;10.0 - - - UMLActor - - 200 - 490 - 100 - 120 - - Performance -Engineer - - - - UMLUseCase - - 380 - 500 - 340 - 50 - - Disable logging completely -Measure performance impact of logging - - - - Relation - - 270 - 510 - 130 - 30 - - lt=->> - 10.0;10.0;110.0;10.0 - - diff --git a/design/datarouter_message_client_impl_connecttodatarouter.uxf b/design/datarouter_backend/datarouter_message_client_impl_connecttodatarouter.uxf similarity index 100% rename from design/datarouter_message_client_impl_connecttodatarouter.uxf rename to design/datarouter_backend/datarouter_message_client_impl_connecttodatarouter.uxf diff --git a/design/mw_log_datarouter_recorder.uxf b/design/datarouter_backend/mw_log_datarouter_recorder.uxf similarity index 100% rename from design/mw_log_datarouter_recorder.uxf rename to design/datarouter_backend/mw_log_datarouter_recorder.uxf diff --git a/design/mw_log_shared_memory_reader.uxf b/design/datarouter_backend/mw_log_shared_memory_reader.uxf similarity index 100% rename from design/mw_log_shared_memory_reader.uxf rename to design/datarouter_backend/mw_log_shared_memory_reader.uxf diff --git a/design/shared_memory_reader_read.uxf b/design/datarouter_backend/shared_memory_reader_read.uxf similarity index 100% rename from design/shared_memory_reader_read.uxf rename to design/datarouter_backend/shared_memory_reader_read.uxf diff --git a/design/shared_memory_writer_allocandwrite.uxf b/design/datarouter_backend/shared_memory_writer_allocandwrite.uxf similarity index 100% rename from design/shared_memory_writer_allocandwrite.uxf rename to design/datarouter_backend/shared_memory_writer_allocandwrite.uxf diff --git a/design/frontend_dependency_graph.puml b/design/frontend_dependency_graph.puml new file mode 100644 index 0000000..ca4d8e4 --- /dev/null +++ b/design/frontend_dependency_graph.puml @@ -0,0 +1,72 @@ +@startuml frontend_dependency_graph +title Frontend Dependency Graph + +package "mw::log frontend" as frontend { + class score::mw::log::Logger { + +Includes classes and free functions + } + class score::mw::log::detail::LogStreamFactory + class score::mw::log::LogStream + class score::mw::log::detail::Runtime + class score::mw::log::LoggerContainer + class score::mw::log::LogTypes + abstract score::mw::log::Recorder + abstract score::mw::log::IRecorderFactory +} + +package "mw::log implementation details" as details { + class score::mw::log::detail::Configuration {} + class score::mw::log::detail::TargetConfigReader {} + + class score::mw::log::detail::DataRouterRecorder {} + class score::mw::log::detail::DataRouterRecorderFactory {} + class score::mw::log::detail::ConsoleRecorder {} + class score::mw::log::detail::ConsoleRecorderFactory {} + class score::mw::log::detail::FileRecorder {} + class score::mw::log::detail::FileRecorderFactory {} + class score::mw::log::detail::CompositeRecorder {} + + class score::mw::log::detail::RecorderFactory {} +} + + +note top of frontend + Frontend contains the public user API, + and the necessary classes to interface + with the backend and implementation details. +end note + +note bottom of details + Instable components shall + depend on stable classes. +end note + +score::mw::log::detail::LogStreamFactory ..> score::mw::log::LogStream +score::mw::log::detail::Runtime o-- score::mw::log::LoggerContainer +score::mw::log::detail::Runtime --> score::mw::log::Recorder +score::mw::log::detail::Runtime o-- score::mw::log::Recorder +score::mw::log::detail::Runtime --> score::mw::log::detail::Configuration +score::mw::log::detail::Configuration --> score::mw::log::detail::TargetConfigReader +score::mw::log::Recorder <|-- score::mw::log::detail::CompositeRecorder + +score::mw::log::Recorder <|-- score::mw::log::detail::FileRecorder +score::mw::log::IRecorderFactory <|-- score::mw::log::detail::FileRecorderFactory +score::mw::log::detail::FileRecorderFactory ..> score::mw::log::detail::FileRecorder + +score::mw::log::Recorder <|-- score::mw::log::detail::DataRouterRecorder +score::mw::log::IRecorderFactory <|-- score::mw::log::detail::DataRouterRecorderFactory +score::mw::log::detail::DataRouterRecorderFactory ..> score::mw::log::detail::DataRouterRecorder + +score::mw::log::Recorder <|-- score::mw::log::detail::ConsoleRecorder +score::mw::log::IRecorderFactory <|-- score::mw::log::detail::ConsoleRecorderFactory +score::mw::log::detail::ConsoleRecorderFactory ..> score::mw::log::detail::ConsoleRecorder + +score::mw::log::detail::RecorderFactory --> score::mw::log::detail::ConsoleRecorder +score::mw::log::detail::RecorderFactory --> score::mw::log::detail::FileRecorder +score::mw::log::detail::RecorderFactory --> score::mw::log::detail::DataRouterRecorder + +score::mw::log::LogStream --> score::mw::log::Recorder +score::mw::log::Logger ..> score::mw::log::LogStream +score::mw::log::LoggerContainer o-- score::mw::log::Logger + +@enduml diff --git a/design/frontend_dependency_graph.uxf b/design/frontend_dependency_graph.uxf deleted file mode 100644 index c998238..0000000 --- a/design/frontend_dependency_graph.uxf +++ /dev/null @@ -1,19 +0,0 @@ -10UMLClass51012033060Logger - -Includes classes and free functionsUMLClass52029014030LogStream -UMLClass69029047030Runtime -UMLClass75021017030LoggerContainerUMLClass51021022030LogStreamFactory -Relation64017030140lt=<-10;120;10;10UMLGeneric200501040390symbol=component -mw::log frontend - //platform/aas/mw/log:frontendUMLNote9079018060Instable components shall -depend on stable classes. -bg=yellowRelation120070810lt=[stability]<-30;10;30;790UMLClass56037010030Log TypesRelation6003103080lt=<-10;60;10;10UMLClass70039020030IRecorderRelation5302303080lt=<-10;60;10;10Relation8102303080lt=<-10;10;10;60Relation7601703060lt=<-10;10;10;40Relation79031030100lt=<-10;80;10;10UMLClass56061014030DataRouterRecorderRelation620410170220lt=<-150;10;10;200UMLClass74061014030ConsoleRecorderUMLClass90061014030FileRecorderRelation79041040220lt=<-10;10;20;200Relation820410140220lt=<-10;10;120;200Relation5301703060lt=<-10;40;10;10UMLNote2108029060Frontend contains the public user API, -and the necessary classes to interface -with the backend and implementation details. - -bg=yellowUMLClass30071077030RecorderFactoryRelation1050310170420lt=<. -decoupled dependency -through -CreateRecorderFactory()10;400;10;10UMLGeneric2004601040310symbol=component -mw::log implementation details - //platform/aas/mw/log/detailRelation620630210100lt=<-10;10;190;80Relation81063030100lt=<-10;10;10;80Relation830630150100lt=<-130;10;10;80Relation7002303080lt=<-10;60;10;10UMLClass93039018030IRecorderFactoryRelation98031030100lt=<-10;80;10;10UMLClass25050013030ConfigurationUMLClass22061014030TargetConfigReaderRelation30063070100lt=<-10;10;50;80Relation34052070210lt=<-10;10;50;190Relation27052050110lt=<-30;10;10;90UMLClass39061014030CompositeRecorderRelation520630260100lt=<-10;10;240;80Relation450410320220lt=<-300;10;10;200 \ No newline at end of file diff --git a/detail/wait_free_producer_queue/design/class_diagram.uxf b/detail/wait_free_producer_queue/design/class_diagram.uxf deleted file mode 100644 index e5b43f6..0000000 --- a/detail/wait_free_producer_queue/design/class_diagram.uxf +++ /dev/null @@ -1,53 +0,0 @@ -10Space for diagram notesUMLClass42080250120<<POD>> -LinearControlBlock --- -+ data: span<byte> -+ acquired_index: atomic_int -+ written_index: atomic_int -+ number_of_writers: atomic_int - -bg=white -fontsize=14UMLClass120280410120WaitFreeLinearWriter --- -+ WaitFreeLinearWriter(control_block: LinearControlBlock&) -+ Acquire(length): optional<AcquiredData > -+ Release(AcquiredData): void - - -bg=white -fontsize=14Relation45019050110lt=<- -uses10;10;10;90UMLClass580280340120LinearReader --- -+ LinearReader(span<Byte>& data) -+ Read(): optional<span<Byte> > - - - - -bg=white -fontsize=14Relation60019050110lt=<- -uses10;10;10;90UMLClass400440300120<<POD>> -AlternatingControlBlock --- -+ linear_control_block_1: LinearControlBlock -+ linear_control_block_2: LinearControlBlock - -bg=white -fontsize=14Relation54019030270lt=<<<<<-10;250;10;10UMLClass90620470120WaitFreeAlternatingWriter --- -+ WaitFreeAlternatingWriter(control_block: AlternatingControlBlock&) -+ Acquire(length): optional<AcquiredData > -+ Release(AcquiredData): void - -bg=white -fontsize=14UMLClass610620440120AlternatingReader --- -+ AlternatingReader(AlternatingControlBlock& data) -+ Read(): optional<span<Byte> > -+ Switch() - - -bg=white -fontsize=14Relation33039030250lt=<<<<<-10;230;10;10Relation4805505090lt=<- -uses10;10;10;70Relation6205505090lt=<- -uses10;10;10;70Relation81039030250lt=<<<<<-10;230;10;10 diff --git a/detail/wait_free_producer_queue/design/wait_free_alternating_buffers.uxf b/detail/wait_free_producer_queue/design/wait_free_alternating_buffers.uxf deleted file mode 100644 index ce3f6ce..0000000 --- a/detail/wait_free_producer_queue/design/wait_free_alternating_buffers.uxf +++ /dev/null @@ -1,152 +0,0 @@ -10Space for diagram notesUMLGeneric26015022040_Producer Thread_ -(WaitFreeAlternatingWriter class) -bg=white -fontsize=14UMLGeneric70015017040_Consumer Thread_ -(AlternatingReader class) -bg=white -fontsize=14Relation3601803060lt=.10;10;10;40UMLObject17022037080Acquire(64 bytes): --- -number_of_writers_1.increment() --- -acquired_index_1 == 72 -number_of_writers_1 == 1 -bg=white -fontsize=14UMLObject3001057080AlternatingControlBlock --- -acquired_index_1 == 0, written_index_1 == 0, number_of_writers_1 == 0 -acquired_index_2 == 0, written_index_2 == 0, number_of_writers_2 == 0 -active_for_writing == 1 -bg=white -fontsize=14Relation3608025090lt=<. -fontsize=1410;70;230;10Relation5808023090lt=<. -fontsize=14210;70;10;10Relation77018030100lt=.10;10;10;80UMLObject670260300260Switch(): - --- - -Reset buffer 2 for writing -acquired_index_2.store(0) -written_index_2.store(0) - --- - -Toggle future writers to use buffer 2 -active_for_writing.store(2) - --- - -Block until pending writers finished on -buffer 1. -bg=white -fontsize=14Relation3602903070lt=.10;10;10;50UMLClass28046021060Release(64 bytes): --- -written_index_1 == (8 + 64) -number_of_writers_1 == 0 -bg=white -fontsize=14UMLClass27034024090WriteDataProducer1(acquired_data) --- -Writing on buffer 1, range [8:72) -bg=white -fontsize=14Relation3604203060lt=.10;10;10;40UMLClass7901120140140[0:8) --- -Data: -16 --- -Length of Packet 2 -bg=white -fontsize=14 -UMLClass640108016030Linear Buffer 2 Content: -bg=white -fontsize=14 -UMLClass9301120160140[8:24) --- -Data: -Packet 2 --- -Producer1, Packet 2 -bg=white -fontsize=14 -UMLClass6901120100140Index Range: --- -Data: - --- -Description -bg=white -fontsize=14 -UMLObject29090057080AlternatingControlBlock --- -acquired_index_1 == 72, written_index_1 == 72, number_of_writers_1 == 0 -acquired_index_2 == 24, written_index_2 == 24, number_of_writers_2 == 0 -active_for_writing == 2 -bg=white -fontsize=14Relation3605103060lt=. -fontsize=14 -10;40;10;10Relation77077030150lt=<. -fontsize=1410;130;10;10UMLClass150108016030Linear Buffer 1 Content: -bg=white -fontsize=14 -UMLClass3101120140140[0:8) --- -Data: -64 --- -Length of Packet 1 -bg=white -fontsize=14 -UMLClass4501120160140[8:72) --- -Data: -WriteDataProducer1() --- -Producer 1, Packet 1 -bg=white -fontsize=14 -UMLClass2101120100140Index Range: --- -Data: - --- -Description -bg=white -fontsize=14 -Relation48050021040lt=<. -fontsize=14 -blocks until10;20;190;20Relation53024016050lt=<. -fontsize=14 -happens -after10;20;140;20UMLClass70057017080Read() --- -buffer_for_reading == 1 -read_range == [0,72) -bg=white -fontsize=14Relation7705103080lt=<. -fontsize=1410;60;10;10UMLClass70070017080Process packet 1 on -buffer 1, range [8:72) - -bg=white -fontsize=14Relation7706403080lt=<. -fontsize=1410;60;10;10UMLObject20055037090Acquire(16 bytes): --- -acquired_index_2 == 24 -number_of_writers_2 == 1 - -bg=white -fontsize=14Relation3608303090lt=<. -fontsize=14 -10;70;10;10UMLClass26067024090WriteDataProducer1(acquired_data) --- -Writing on buffer 2, range [8:24) -bg=white -fontsize=14UMLClass28078021060Release(16 bytes): --- -written_index_2 == 8 + 16 -number_of_writers_2 == 0 -bg=white -fontsize=14Relation3606303060lt=. -fontsize=14 -10;40;10;10Relation3607503050lt=. -fontsize=14 -10;30;10;10Relation49072023050lt=<.> -fontsize=14 -concurrent writing -and reading10;20;210;20 diff --git a/detail/wait_free_producer_queue/design/wait_free_linear_buffer.uxf b/detail/wait_free_producer_queue/design/wait_free_linear_buffer.uxf deleted file mode 100644 index f0cb764..0000000 --- a/detail/wait_free_producer_queue/design/wait_free_linear_buffer.uxf +++ /dev/null @@ -1,101 +0,0 @@ -10UMLGeneric10013019040_Producer Thread 1_ -(WaitFreeLinearWriter class) -bg=white -fontsize=14UMLGeneric52013019040_Producer Thread 2_ -(WaitFreeLinearWriter class) -bg=white -fontsize=14Relation1901603080lt=.10;10;10;60UMLObject4022032080Acquire(64 bytes): --- -length_index = acquired_index.fetch_add(8 + 64) --- -acquired_index == 72 -length_index == 0 -bg=white -fontsize=14UMLObject1303057040LinearControlBlock --- -acquired_index == 0, written_index == 0 -bg=white -fontsize=14Relation1906025090lt=<. -fontsize=1410;70;230;10Relation4106023090lt=<. -fontsize=14210;70;10;10Relation60016030160lt=.10;10;10;140UMLObject50030030070Acquire(16 bytes): --- -acquired_index == 96 -length_index == 72 -bg=white -fontsize=14Relation19029030140lt=.10;10;10;120Relation35028017040lt=<. -happens before -bg=white -fontsize=14150;20;10;20Relation6003603070lt=.10;10;10;50UMLClass11061021050Release(64 bytes): --- -written_index == 24 + (8 + 64) -bg=white -fontsize=14UMLClass51054021070Release(16 bytes): --- -written_index.fetch_add(8 + 16) --- -written_index == 8 + 16 -bg=white -fontsize=14UMLClass49041024090WriteDataProducer2(acquired_data) --- -Writing on range [80:96) -bg=white -fontsize=14UMLClass10041024090WriteDataProducer1(acquired_data) --- -Writing on range [8:72) -bg=white -fontsize=14Relation33043018050lt=<.> -Concurrent -Writing -bg=white -fontsize=1410;20;160;20Relation6004903070lt=.10;10;10;50Relation19049030140lt=.10;10;10;120Relation31059022040lt=<. -happens before -bg=white -fontsize=1410;20;200;20UMLClass180830140140[0:8) --- -Data: -64 --- -Length of Producer1 -bg=white -fontsize=14 -group=1UMLClass3078016030Linear Buffer Content: -bg=white -fontsize=14UMLClass320830160140[8:72) --- -Data: -WriteDataProducer1() --- -Payload of Producer1 -bg=white -fontsize=14 -group=1UMLClass480830160140[72:80) --- -Data: -16 --- -Length of Payload 2 -bg=white -fontsize=14 -group=1UMLClass80830100140Index Range: --- -Data: - --- -Description -bg=white -fontsize=14 -group=1UMLClass640830160140[88:96) --- -Data: -WriteDataProducer2() --- -Payload of Producer2 -bg=white -fontsize=14 -group=1UMLObject12068057040LinearControlBlock --- -acquired_index == written_index == 96 -bg=white -fontsize=14Relation1906503050lt=<. -fontsize=1410;30;10;10Relation60060030100lt=<. -fontsize=1410;80;10;10