[PATCH 5/7] libdl/obj-comp: Add trace prints when decompressing
chrisj at rtems.org
chrisj at rtems.org
Tue May 5 05:02:05 UTC 2020
From: Chris Johns <chrisj at rtems.org>
Updates #3969
---
cpukit/include/rtems/rtl/rtl-trace.h | 2 ++
cpukit/libdl/rtl-obj-comp.c | 31 ++++++++++++++++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/cpukit/include/rtems/rtl/rtl-trace.h b/cpukit/include/rtems/rtl/rtl-trace.h
index 06c72c8992..196b4ff42e 100644
--- a/cpukit/include/rtems/rtl/rtl-trace.h
+++ b/cpukit/include/rtems/rtl/rtl-trace.h
@@ -54,7 +54,9 @@ typedef uint32_t rtems_rtl_trace_mask;
#define RTEMS_RTL_TRACE_ARCHIVE_SYMS (1UL << 13)
#define RTEMS_RTL_TRACE_DEPENDENCY (1UL << 14)
#define RTEMS_RTL_TRACE_BIT_ALLOC (1UL << 15)
+#define RTEMS_RTL_TRACE_COMP (1UL << 16)
#define RTEMS_RTL_TRACE_ALL (0xffffffffUL & ~(RTEMS_RTL_TRACE_CACHE | \
+ RTEMS_RTL_TRACE_COMP | \
RTEMS_RTL_TRACE_GLOBAL_SYM | \
RTEMS_RTL_TRACE_ARCHIVE_SYMS))
diff --git a/cpukit/libdl/rtl-obj-comp.c b/cpukit/libdl/rtl-obj-comp.c
index 36825baebe..4608a41bf4 100644
--- a/cpukit/libdl/rtl-obj-comp.c
+++ b/cpukit/libdl/rtl-obj-comp.c
@@ -21,10 +21,13 @@
#include <errno.h>
#include <string.h>
#include <unistd.h>
+#include <inttypes.h>
+#include <rtems/inttypes.h>
#include <rtems/rtl/rtl-allocator.h>
#include <rtems/rtl/rtl-obj-comp.h>
#include "rtl-error.h"
+#include <rtems/rtl/rtl-trace.h>
#include "fastlz.h"
@@ -91,6 +94,13 @@ rtems_rtl_obj_comp_read (rtems_rtl_obj_comp* comp,
return false;
}
+ if (rtems_rtl_trace (RTEMS_RTL_TRACE_COMP))
+ printf ("rtl: comp: %2d: fd=%d length=%zu level=%u offset=%" PRIdoff_t " area=[%"
+ PRIdoff_t ",%" PRIdoff_t "] read=%" PRIu32 " size=%zu\n",
+ comp->fd, comp->cache->fd, length, comp->level, comp->offset,
+ comp->offset, comp->offset + length,
+ comp->read, comp->size);
+
if (comp->fd != comp->cache->fd)
{
comp->level = 0;
@@ -104,10 +114,18 @@ rtems_rtl_obj_comp_read (rtems_rtl_obj_comp* comp,
if (buffer_level)
{
+ if (rtems_rtl_trace (RTEMS_RTL_TRACE_COMP))
+ printf ("rtl: comp: copy: length=%zu\n",
+ buffer_level);
+
memcpy (bin, comp->buffer, buffer_level);
if ((comp->level - buffer_level) != 0)
{
+ if (rtems_rtl_trace (RTEMS_RTL_TRACE_COMP))
+ printf ("rtl: comp: copy-down: level=%u length=%zu\n",
+ comp->level, comp->level - buffer_level);
+
memmove (comp->buffer,
comp->buffer + buffer_level,
comp->level - buffer_level);
@@ -126,6 +144,10 @@ rtems_rtl_obj_comp_read (rtems_rtl_obj_comp* comp,
size_t in_length = sizeof (block_size);
int decompressed;
+ if (rtems_rtl_trace (RTEMS_RTL_TRACE_COMP))
+ printf ("rtl: comp: read block-size: offset=%" PRIdoff_t "\n",
+ comp->offset);
+
if (!rtems_rtl_obj_cache_read (comp->cache, comp->fd, comp->offset,
(void**) &input, &in_length))
return false;
@@ -136,6 +158,10 @@ rtems_rtl_obj_comp_read (rtems_rtl_obj_comp* comp,
in_length = block_size;
+ if (rtems_rtl_trace (RTEMS_RTL_TRACE_COMP))
+ printf ("rtl: comp: read block: offset=%" PRIdoff_t " size=%u\n",
+ comp->offset, block_size);
+
if (!rtems_rtl_obj_cache_read (comp->cache, comp->fd, comp->offset,
(void**) &input, &in_length))
return false;
@@ -172,6 +198,11 @@ rtems_rtl_obj_comp_read (rtems_rtl_obj_comp* comp,
comp->offset += block_size;
comp->level = decompressed;
+
+ if (rtems_rtl_trace (RTEMS_RTL_TRACE_COMP))
+ printf ("rtl: comp: expand: offset=%" PRIdoff_t \
+ " level=%u read=%" PRIu32 "\n",
+ comp->offset, comp->level, comp->read);
}
}
--
2.24.1
More information about the devel
mailing list