[rtems commit] libdl/obj-comp: Add trace prints when decompressing
Chris Johns
chrisj at rtems.org
Tue May 5 05:03:32 UTC 2020
Module: rtems
Branch: master
Commit: 3635d6a8366ae1a5fc2908d59ffa4855670fa512
Changeset: http://git.rtems.org/rtems/commit/?id=3635d6a8366ae1a5fc2908d59ffa4855670fa512
Author: Chris Johns <chrisj at rtems.org>
Date: Tue May 5 14:57:34 2020 +1000
libdl/obj-comp: Add trace prints when decompressing
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 06c72c8..196b4ff 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 36825ba..4608a41 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);
}
}
More information about the vc
mailing list