Skip to content

Commit 08d5770

Browse files
committed
🔥 Remove sc
1 parent 99efdb4 commit 08d5770

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+277
-1223
lines changed

CMakeLists.txt

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -33,27 +33,9 @@ set(GEN_STR_CATALOG
3333
${CMAKE_CURRENT_LIST_DIR}/tools/gen_str_catalog.py
3434
CACHE FILEPATH "Location of script to generate a string catalog")
3535

36-
add_library(cib_sc INTERFACE)
37-
target_compile_features(cib_sc INTERFACE cxx_std_20)
38-
target_link_libraries_system(cib_sc INTERFACE fmt::fmt-header-only stdx)
39-
40-
target_sources(
41-
cib_sc
42-
INTERFACE FILE_SET
43-
sc
44-
TYPE
45-
HEADERS
46-
BASE_DIRS
47-
include
48-
FILES
49-
include/sc/format.hpp
50-
include/sc/fwd.hpp
51-
include/sc/lazy_string_format.hpp
52-
include/sc/string_constant.hpp)
53-
5436
add_library(cib_match INTERFACE)
5537
target_compile_features(cib_match INTERFACE cxx_std_20)
56-
target_link_libraries_system(cib_match INTERFACE cib_sc stdx)
38+
target_link_libraries_system(cib_match INTERFACE stdx)
5739

5840
target_sources(
5941
cib_match
@@ -80,7 +62,7 @@ target_sources(
8062

8163
add_library(cib_interrupt INTERFACE)
8264
target_compile_features(cib_interrupt INTERFACE cxx_std_20)
83-
target_link_libraries_system(cib_interrupt INTERFACE cib_sc concurrency stdx)
65+
target_link_libraries_system(cib_interrupt INTERFACE concurrency stdx)
8466

8567
target_sources(
8668
cib_interrupt
@@ -124,7 +106,7 @@ target_sources(
124106

125107
add_library(cib_log INTERFACE)
126108
target_compile_features(cib_log INTERFACE cxx_std_20)
127-
target_link_libraries_system(cib_log INTERFACE cib_sc stdx)
109+
target_link_libraries_system(cib_log INTERFACE stdx)
128110

129111
target_sources(
130112
cib_log
@@ -147,7 +129,6 @@ target_link_libraries_system(
147129
cib_log
148130
cib_lookup
149131
cib_match
150-
cib_sc
151132
stdx)
152133

153134
target_sources(
@@ -238,7 +219,7 @@ target_sources(
238219

239220
add_library(cib_flow INTERFACE)
240221
target_compile_features(cib_flow INTERFACE cxx_std_20)
241-
target_link_libraries_system(cib_flow INTERFACE cib_log cib_nexus cib_sc stdx)
222+
target_link_libraries_system(cib_flow INTERFACE cib_log cib_nexus stdx)
242223

243224
target_sources(
244225
cib_flow
@@ -263,14 +244,7 @@ target_sources(
263244

264245
add_library(cib_seq INTERFACE)
265246
target_compile_features(cib_seq INTERFACE cxx_std_20)
266-
target_link_libraries_system(
267-
cib_seq
268-
INTERFACE
269-
cib_flow
270-
cib_log
271-
cib_nexus
272-
cib_sc
273-
stdx)
247+
target_link_libraries_system(cib_seq INTERFACE cib_flow cib_log cib_nexus stdx)
274248

275249
target_sources(
276250
cib_seq
@@ -300,7 +274,6 @@ target_link_libraries_system(
300274
cib_match
301275
cib_msg
302276
cib_nexus
303-
cib_sc
304277
cib_seq
305278
concurrency
306279
fmt::fmt-header-only
@@ -330,7 +303,6 @@ if(PROJECT_IS_TOP_LEVEL)
330303
clang_tidy_interface(cib_match)
331304
clang_tidy_interface(cib_msg)
332305
clang_tidy_interface(cib_nexus)
333-
clang_tidy_interface(cib_sc)
334306
clang_tidy_interface(cib_seq)
335307

336308
# Enable functional and performance test suites.

README.md

Lines changed: 0 additions & 186 deletions
This file was deleted.

docs/index.adoc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,4 @@ include::logging.adoc[]
1313
include::interrupts.adoc[]
1414
include::match.adoc[]
1515
include::message.adoc[]
16-
include::sc.adoc[]
1716
include::implementation_details.adoc[]

docs/intro.adoc

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ _cib_ contains several parts that work together:
4747
- xref:interrupt.adoc#_the_interrupt_library[`interrupt`]
4848
- xref:match.adoc#_the_match_library[`match`]
4949
- xref:message.adoc#_the_message_library[`message`]
50-
- xref:sc.adoc#_the_sc_string_constant_library[`sc` (string constant)]
5150

5251
=== Sub-library DAG
5352

@@ -57,24 +56,21 @@ library that contains all the functionality.
5756
[mermaid, format="svg"]
5857
----
5958
flowchart BT
60-
sc(cib_sc)
6159
nexus(cib_nexus)
6260
lookup(cib_lookup)
61+
log(cib_log)
62+
match(cib_match)
6363
6464
flow(cib_flow) --> nexus
6565
flow --> log
6666
67-
interrupt(cib_interrupt) --> sc
68-
match(cib_match) --> sc
69-
log(cib_log) --> sc
70-
71-
7267
log_fmt(cib_log_fmt) --> log
7368
msg(cib_msg) --> log & match
7469
msg --> lookup
7570
7671
log_mipi(cib_log_mipi) --> msg
7772
seq(cib_seq) --> flow
7873
79-
cib --> interrupt & seq & log_fmt & log_mipi
74+
interrupt(cib_interrupt)
75+
cib(cib) --> interrupt & seq & log_fmt & log_mipi
8076
----

docs/logging.adoc

Lines changed: 48 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ struct my_logger_config {
9797

9898
Notice that the first two template parameters to log are the
9999
xref:logging.adoc#_log_levels[level] and the xref:logging.adoc#_modules[module
100-
ID]. The `ModuleId` type is a xref:sc.adoc#_string_constants[compile-time string].
100+
ID].
101101

102102
The first two runtime parameters receive preprocessor `\_​_FILE_​\_` and `__LINE_​_` values
103103
respectively. The `msg` argument is a structure containing a
104-
xref:sc.adoc#_formatting_strings[compile-time format string] and runtime
104+
compile-time format string and runtime
105105
arguments to be interpolated into it. It supports an `apply` function, so one
106106
way to implement `log` is:
107107

@@ -188,11 +188,52 @@ struct my_struct {
188188
}
189189
----
190190

191-
=== String data
192-
193-
On a constrained system, space for text can be at a premium. The `sc` library
194-
and the MIPI Sys-T logger combine to
195-
xref:sc.adoc#_efficient_logging_with_mipi_sys_t[solve this problem].
191+
=== Efficient logging with MIPI Sys-T
192+
193+
On a constrained system, space for text can be limited-to-nonexistent. `cib`
194+
uses `stdx::ct_format` and the
195+
https://github.com/intel/compile-time-init-build/tree/main/include/log/catalog/mipi_encoder.hpp[MIPI
196+
Sys-T logging config] to solve this problem.
197+
198+
- First, each string constant contains string character data in its type.
199+
- The MIPI logger calls the function template specialization
200+
https://github.com/intel/compile-time-init-build/blob/main/include/log/catalog/catalog.hpp[`catalog`]
201+
to get the catalog ID corresponding to each string constant.
202+
203+
But: the `catalog` function template is just that -- only a template -- to
204+
begin with. It is specialized as follows:
205+
206+
- The application is built as a library.
207+
- Running `nm` on that library reveals missing symbols: precisely the function
208+
specializations that are required for all the string constants.
209+
- Those symbols are used to generate the template specializations in another
210+
file, which itself is compiled into a library.
211+
- String data is recovered from the symbol types and used to generate the
212+
catalog collateral in XML and/or JSON format.
213+
- Link-time optimization inlines the `catalog` function template
214+
specializations, each of which is a one-line function that returns a
215+
catalog ID.
216+
217+
Thus no string data exists in the executable, but the correct catalog IDs are
218+
used in logging, and the remote log handler can reconstitute the actual strings.
219+
The XML and JSON collateral also contains information about any runtime
220+
arguments that need to be interpolated into the string and whose values are sent
221+
by the MIPI Sys-T logger after the catalog ID.
222+
223+
==== Tooling support
224+
225+
The process of generating log strings from the type information revealed by
226+
missing symbols is automated by a
227+
https://github.com/intel/compile-time-init-build/blob/main/tools/gen_str_catalog.py[python
228+
script] provided and by a
229+
https://github.com/intel/compile-time-init-build/blob/main/cmake/string_catalog.cmake[CMake
230+
wrapper function (`gen_str_catalog`)] that drives the process. See
231+
https://github.com/intel/compile-time-init-build/blob/main/test/CMakeLists.txt[the
232+
test] that exercises that functionality for an example.
233+
234+
NOTE: This process assigns IDs to both strings and
235+
xref:logging.adoc#_modules[log modules]. `catalog` is specialized for catalog
236+
IDs; `module` is specialized for module IDs.
196237

197238
=== Version logging
198239

0 commit comments

Comments
 (0)