Commit 651c6bf2 authored by Alessandro Rubini's avatar Alessandro Rubini Committed by Grzegorz Daniluk

fix dump info for new structures

Signed-off-by: Alessandro Rubini's avatarAlessandro Rubini <rubini@gnudd.com>
parent 90d75a98
......@@ -46,8 +46,8 @@ struct dump_info dump_info[] = {
DUMP_HEADER("DSCurrent"),
DUMP_FIELD(UInteger16, stepsRemoved),
DUMP_FIELD(TimeInternal, offsetFromMaster),
DUMP_FIELD(TimeInternal, meanPathDelay), /* oneWayDelay */
DUMP_FIELD(pp_time, offsetFromMaster),
DUMP_FIELD(pp_time, meanPathDelay), /* oneWayDelay */
DUMP_FIELD(UInteger16, primarySlavePortNumber),
#undef DUMP_STRUCT
......@@ -88,15 +88,15 @@ struct dump_info dump_info[] = {
DUMP_FIELD(Integer32, delta_rx_s),
DUMP_FIELD(Integer32, fiber_fix_alpha),
DUMP_FIELD(Integer32, clock_period_ps),
DUMP_FIELD(TimeInternal, t1),
DUMP_FIELD(TimeInternal, t2),
DUMP_FIELD(TimeInternal, t3),
DUMP_FIELD(TimeInternal, t4),
DUMP_FIELD(TimeInternal, t5),
DUMP_FIELD(TimeInternal, t6),
DUMP_FIELD(pp_time, t1),
DUMP_FIELD(pp_time, t2),
DUMP_FIELD(pp_time, t3),
DUMP_FIELD(pp_time, t4),
DUMP_FIELD(pp_time, t5),
DUMP_FIELD(pp_time, t6),
DUMP_FIELD(Integer64, delta_ms_prev),
DUMP_FIELD(int, missed_iters),
DUMP_FIELD(TimeInternal, mu), /* half of the RTT */
DUMP_FIELD(pp_time, mu), /* half of the RTT */
DUMP_FIELD(Integer64, picos_mu),
DUMP_FIELD(Integer32, cur_setpoint),
DUMP_FIELD(Integer64, delta_ms),
......@@ -108,7 +108,7 @@ struct dump_info dump_info[] = {
DUMP_FIELD(UInteger32, n_err_state),
DUMP_FIELD(UInteger32, n_err_offset),
DUMP_FIELD(UInteger32, n_err_delta_rtt),
DUMP_FIELD(TimeInternal, update_time),
DUMP_FIELD(pp_time, update_time),
#undef DUMP_STRUCT
#define DUMP_STRUCT struct pp_instance
......@@ -155,17 +155,17 @@ struct dump_info dump_info[] = {
DUMP_FIELD_SIZE(bina, peer, 6),
DUMP_FIELD(uint16_t, peer_vid),
DUMP_FIELD(TimeInternal, t1),
DUMP_FIELD(TimeInternal, t2),
DUMP_FIELD(TimeInternal, t3),
DUMP_FIELD(TimeInternal, t4),
DUMP_FIELD(TimeInternal, t5),
DUMP_FIELD(TimeInternal, t6),
DUMP_FIELD(pp_time, t1),
DUMP_FIELD(pp_time, t2),
DUMP_FIELD(pp_time, t3),
DUMP_FIELD(pp_time, t4),
DUMP_FIELD(pp_time, t5),
DUMP_FIELD(pp_time, t6),
DUMP_FIELD(Integer32, t4_cf),
DUMP_FIELD(Integer32, t6_cf),
DUMP_FIELD(TimeInternal, cField),
DUMP_FIELD(TimeInternal, last_rcv_time),
DUMP_FIELD(TimeInternal, last_snt_time),
DUMP_FIELD(pp_time, cField),
DUMP_FIELD(pp_time, last_rcv_time),
DUMP_FIELD(pp_time, last_snt_time),
DUMP_FIELD(UInteger16, frgn_rec_num),
DUMP_FIELD(Integer16, frgn_rec_best),
//DUMP_FIELD(struct pp_frgn_master frgn_master[PP_NR_FOREIGN_RECORDS]),
......
......@@ -39,12 +39,13 @@ enum dump_type {
dump_type_PortIdentity,
dump_type_ClockQuality,
/* and this is ours */
dump_type_TimeInternal,
dump_type_pp_time,
dump_type_ip_address,
};
/* because of the sizeof later on, we need these typedefs */
typedef void * pointer;
typedef struct pp_time pp_time;
typedef unsigned long unsigned_long;
typedef unsigned char unsigned_char;
typedef unsigned short unsigned_short;
......
......@@ -57,6 +57,19 @@ static int wrpc_get_i32(void *p)
{
return wrpc_get_l32(p);
}
static int64_t wrpc_get_i64(void *p)
{
int64_t *p64 = p, i64;
if (endian_flag == DUMP_ENDIAN_FLAG)
return *p64;
/* uff... */
i64 = *p64;
i64 = __bswap_32(i64 & 0xffffffff);
i64 <<= 32;
i64 |= __bswap_32(i64 >> 32);
return i64;
}
static int wrpc_get_16(void *p)
{
......@@ -71,7 +84,7 @@ static int wrpc_get_16(void *p)
void dump_one_field(void *addr, struct dump_info *info)
{
void *p = addr + wrpc_get_i32(&info->offset);
struct TimeInternal *ti = p;
struct pp_time *t = p;
struct PortIdentity *pi = p;
struct ClockQuality *cq = p;
char format[16];
......@@ -137,13 +150,19 @@ void dump_one_field(void *addr, struct dump_info *info)
case dump_type_Integer16:
printf("%i\n", wrpc_get_16(p));
break;
case dump_type_TimeInternal:
printf("correct %i: %10i.%09i:%04i\n",
wrpc_get_i32(&ti->correct),
wrpc_get_i32(&ti->seconds),
wrpc_get_i32(&ti->nanoseconds),
wrpc_get_i32(&ti->phase));
case dump_type_pp_time:
{
struct pp_time localt;
localt.secs = wrpc_get_i64(&t->secs);
localt.scaled_nsecs = wrpc_get_i64(&t->scaled_nsecs);
printf("correct %i: %10lli.%09li:0x%04x\n",
!is_incorrect(&localt),
(long long)localt.secs,
(long)(localt.scaled_nsecs >> 16),
(int)(localt.scaled_nsecs & 0xffff));
break;
}
case dump_type_ip_address:
for (i = 0; i < 4; i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment