From 6bd4fc6943112db14c0b71fac707cf3def22aa83 Mon Sep 17 00:00:00 2001 From: Hans Nilsson Date: Wed, 8 Aug 2018 19:31:27 +0200 Subject: ssh: Circular trace buffer primitives --- lib/ssh/src/ssh.hrl | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'lib/ssh/src/ssh.hrl') diff --git a/lib/ssh/src/ssh.hrl b/lib/ssh/src/ssh.hrl index 9631427749..01c44cb371 100644 --- a/lib/ssh/src/ssh.hrl +++ b/lib/ssh/src/ssh.hrl @@ -492,4 +492,29 @@ -define(wr_record(N), ?wr_record(N, [])). +%% Circular trace buffer macros + +-record(circ_buf_entry, + { + module, + line, + function, + pid = self(), + value + }). + +-define(CIRC_BUF_IN(VALUE), + ssh_dbg:cbuf_in( + #circ_buf_entry{module = ?MODULE, + line = ?LINE, + function = {?FUNCTION_NAME,?FUNCTION_ARITY}, + pid = self(), + value = (VALUE) + }) + ). + +-define(CIRC_BUF_IN_ONCE(VALUE), + ((fun(V) -> ?CIRC_BUF_IN(V), V end)(VALUE)) + ). + -endif. % SSH_HRL defined -- cgit v1.2.3