Skip to content

Commit 68a6a3e

Browse files
nordic-krchnashif
authored andcommitted
logging: Cleaning references to tracing in logging
There were some leftovers in logging after attempt to use logging as tracing backend. Removing all references since it lead to test compilation failures. Signed-off-by: Krzysztof Chruscinski <[email protected]>
1 parent dff331a commit 68a6a3e

File tree

4 files changed

+1
-114
lines changed

4 files changed

+1
-114
lines changed

include/logging/log_core2.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,6 @@
1212
extern "C" {
1313
#endif
1414

15-
#define Z_TRACING_LOG_TRACE(id) do { \
16-
Z_TRACING_LOG_HDR_INIT(_msg, id); \
17-
z_log_msg2_put_trace(_msg); \
18-
} while (0)
19-
20-
#define Z_TRACING_LOG_TRACE_PTR(id, ptr) do { \
21-
Z_TRACING_LOG_HDR_INIT(_msg, id); \
22-
z_log_msg2_put_trace_ptr(_msg, ptr); \
23-
} while (0)
24-
25-
void z_log_msg2_put_trace(struct log_msg2_trace trace);
26-
27-
void z_log_msg2_put_trace_ptr(struct log_msg2_trace hdr, void *data);
28-
29-
3015
/** @brief Initialize module for handling logging message. */
3116
void z_log_msg2_init(void);
3217

include/logging/log_msg2.h

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ typedef uint32_t log_timestamp_t;
4242
*/
4343

4444
#define Z_LOG_MSG2_LOG 0
45-
#define Z_LOG_MSG2_TRACE 1
4645

4746
#define LOG_MSG2_GENERIC_HDR \
4847
MPSC_PBUF_HDR;\
@@ -57,16 +56,6 @@ struct log_msg2_desc {
5756
uint32_t reserved:1;
5857
};
5958

60-
struct log_msg2_trace_hdr {
61-
LOG_MSG2_GENERIC_HDR;
62-
uint32_t evt_id:5;
63-
#if CONFIG_LOG_TRACE_SHORT_TIMESTAMP
64-
uint32_t timestamp:24;
65-
#else
66-
log_timestamp_t timestamp;
67-
#endif
68-
};
69-
7059
union log_msg2_source {
7160
const struct log_source_const_data *fixed;
7261
struct log_source_dynamic_data *dynamic;
@@ -93,15 +82,6 @@ struct log_msg2_hdr {
9382
#endif
9483
};
9584

96-
struct log_msg2_trace {
97-
struct log_msg2_trace_hdr hdr;
98-
};
99-
100-
struct log_msg2_trace_ptr {
101-
struct log_msg2_trace_hdr hdr;
102-
void *ptr;
103-
};
104-
10585
struct log_msg2 {
10686
struct log_msg2_hdr hdr;
10787
uint8_t data[];
@@ -114,8 +94,6 @@ struct log_msg2_generic_hdr {
11494
union log_msg2_generic {
11595
union mpsc_pbuf_generic buf;
11696
struct log_msg2_generic_hdr generic;
117-
struct log_msg2_trace trace;
118-
struct log_msg2_trace_ptr trace_ptr;
11997
struct log_msg2 log;
12098
};
12199

@@ -424,16 +402,6 @@ do { \
424402
_domain_id, _source, _level, _data, _dlen, \
425403
Z_LOG_STR(_level, __VA_ARGS__))
426404

427-
#define Z_TRACING_LOG_HDR_INIT(name, id) \
428-
struct log_msg2_trace name = { \
429-
.hdr = { \
430-
.type = Z_LOG_MSG2_TRACE, \
431-
.valid = 1, \
432-
.busy = 0, \
433-
.evt_id = id, \
434-
} \
435-
}
436-
437405
/** @brief Finalize message.
438406
*
439407
* Finalization includes setting source, copying data and timestamp in the
@@ -552,7 +520,6 @@ static inline uint32_t log_msg2_generic_get_wlen(const union mpsc_pbuf_generic *
552520
return log_msg2_get_total_wlen(msg->hdr.desc);
553521
}
554522

555-
/* trace TODO */
556523
return 0;
557524
}
558525

subsys/logging/log_core.c

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,35 +1175,6 @@ void z_log_msg2_init(void)
11751175
mpsc_pbuf_init(&log_buffer, &mpsc_config);
11761176
}
11771177

1178-
static uint32_t log_diff_timestamp(void)
1179-
{
1180-
extern log_timestamp_get_t timestamp_func;
1181-
1182-
return timestamp_func();
1183-
}
1184-
1185-
void z_log_msg2_put_trace(struct log_msg2_trace trace)
1186-
{
1187-
union log_msg2_generic generic = {
1188-
.trace = trace
1189-
};
1190-
1191-
trace.hdr.timestamp = IS_ENABLED(CONFIG_LOG_TRACE_SHORT_TIMESTAMP) ?
1192-
log_diff_timestamp() : timestamp_func();
1193-
mpsc_pbuf_put_word(&log_buffer, generic.buf);
1194-
}
1195-
1196-
void z_log_msg2_put_trace_ptr(struct log_msg2_trace trace, void *data)
1197-
{
1198-
union log_msg2_generic generic = {
1199-
.trace = trace
1200-
};
1201-
1202-
trace.hdr.timestamp = IS_ENABLED(CONFIG_LOG_TRACE_SHORT_TIMESTAMP) ?
1203-
log_diff_timestamp() : timestamp_func();
1204-
mpsc_pbuf_put_word_ext(&log_buffer, generic.buf, data);
1205-
}
1206-
12071178
struct log_msg2 *z_log_msg2_alloc(uint32_t wlen)
12081179
{
12091180
return (struct log_msg2 *)mpsc_pbuf_alloc(&log_buffer, wlen,

tests/subsys/logging/log_msg2/src/main.c

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -569,40 +569,6 @@ void test_saturate(void)
569569
zassert_equal(msg, NULL, "Expected no pending messages");
570570
}
571571

572-
#define TRACE_ID1 (1)
573-
#define TRACE_ID2 (31)
574-
void test_log_msg2_put_trace(void)
575-
{
576-
union log_msg2_generic *msg;
577-
578-
Z_TRACING_LOG_HDR_INIT(trace, TRACE_ID1);
579-
580-
test_init();
581-
z_log_msg2_put_trace(trace);
582-
msg = z_log_msg2_claim();
583-
zassert_true(msg, "Unexpected null message");
584-
zassert_equal(msg->generic.type, Z_LOG_MSG2_TRACE, "Unexpected type");
585-
zassert_equal(msg->trace.hdr.evt_id, TRACE_ID1, "Unexpected ID");
586-
z_log_msg2_free(msg);
587-
}
588-
589-
#define SIZE_OF_TRACE_DATA (10)
590-
void test_log_msg2_put_trace_ptr(void)
591-
{
592-
uint32_t trace_data = 0x1234;
593-
union log_msg2_generic *msg;
594-
595-
Z_TRACING_LOG_HDR_INIT(trace, TRACE_ID2);
596-
597-
test_init();
598-
z_log_msg2_put_trace_ptr(trace, (void *)&trace_data);
599-
msg = z_log_msg2_claim();
600-
zassert_true(msg, "Unexpected null message");
601-
zassert_equal(msg->generic.type, Z_LOG_MSG2_TRACE, "Unexpected type");
602-
zassert_equal(msg->trace.hdr.evt_id, TRACE_ID2, "Unexpected ID");
603-
z_log_msg2_free(msg);
604-
}
605-
606572
/*test case main entry*/
607573
void test_main(void)
608574
{
@@ -616,9 +582,7 @@ void test_main(void)
616582
ztest_unit_test(test_mode_size_data_only),
617583
ztest_unit_test(test_mode_size_plain_str_data),
618584
ztest_unit_test(test_mode_size_str_with_2strings),
619-
ztest_unit_test(test_saturate),
620-
ztest_unit_test(test_log_msg2_put_trace),
621-
ztest_unit_test(test_log_msg2_put_trace_ptr)
585+
ztest_unit_test(test_saturate)
622586
);
623587
ztest_run_test_suite(test_log_msg2);
624588
}

0 commit comments

Comments
 (0)