Skip to content

Instantly share code, notes, and snippets.

@agentzh
Created June 16, 2020 21:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agentzh/51ffa8f2ca895264fab0f3706f187439 to your computer and use it in GitHub Desktop.
Save agentzh/51ffa8f2ca895264fab0f3706f187439 to your computer and use it in GitHub Desktop.
diff --git a/runtime/transport/relay_v2.c b/runtime/transport/relay_v2.c
index 135951a8e..12ca330e0 100644
--- a/runtime/transport/relay_v2.c
+++ b/runtime/transport/relay_v2.c
@@ -269,12 +269,33 @@ static void _stp_transport_data_fs_start(void)
static void _stp_transport_data_fs_stop(void)
{
+ struct rchan_buf *buf;
+
if (atomic_read (&_stp_relay_data.transport_state) == STP_TRANSPORT_RUNNING) {
atomic_set (&_stp_relay_data.transport_state, STP_TRANSPORT_STOPPED);
del_timer_sync(&_stp_relay_data.timer);
dbug_trans(0, "flushing...\n");
- if (_stp_relay_data.rchan)
+ buf = _stp_get_rchan_subbuf(_stp_relay_data.rchan->buf, smp_processor_id());
+ dbug_xxx(0, "relay: subbufs produced: %d, subbufs consumed: %d, "
+ "bytes consumed: %d, offset: %d",
+ (int) buf->subbufs_produced, (int) buf->subbufs_consumed,
+ (int) buf->bytes_consumed, (int) buf->offset
+ );
+ if (_stp_relay_data.rchan) {
+ dbug_xxx(0, "relay before flush: subbufs produced: %d, subbufs consumed: %d, "
+ "bytes consumed: %d, offset: %d",
+ (int) buf->subbufs_produced, (int) buf->subbufs_consumed,
+ (int) buf->bytes_consumed, (int) buf->offset
+ );
+
relay_flush(_stp_relay_data.rchan);
+
+ dbug_xxx(0, "relay after flush: subbufs produced: %d, subbufs consumed: %d, "
+ "bytes consumed: %d, offset: %d",
+ (int) buf->subbufs_produced, (int) buf->subbufs_consumed,
+ (int) buf->bytes_consumed, (int) buf->offset
+ );
+ }
}
}
@@ -285,7 +306,15 @@ static void _stp_transport_data_fs_close(void)
if (_stp_relay_data.dropped_file)
debugfs_remove(_stp_relay_data.dropped_file);
#endif
+ //printk("rchan: 0x%lx", (unsigned long) _stp_relay_data.rchan);
if (_stp_relay_data.rchan) {
+ struct rchan_buf *buf;
+ buf = _stp_get_rchan_subbuf(_stp_relay_data.rchan->buf, smp_processor_id());
+ if (buf) {
+ dbug_xxx(0, "relay: subbufs produced: %d, subbufs consumed: %d, bytes consumed: %d, offset: %d", (int) buf->subbufs_produced, (int) buf->subbufs_consumed, (int) buf->bytes_consumed, (int) buf->offset);
+ dbug_xxx(0, "relay: subbufs produced: %d, subbufs consumed: %d, bytes consumed: %d, offset: %d", (int) buf->subbufs_produced, (int) buf->subbufs_consumed, (int) buf->bytes_consumed, (int) buf->offset);
+ }
+
relay_close(_stp_relay_data.rchan);
_stp_relay_data.rchan = NULL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment