Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
Software for White Rabbit PTP Core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
32
Issues
32
List
Board
Labels
Milestones
Merge Requests
6
Merge Requests
6
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Software for White Rabbit PTP Core
Commits
22f24ec4
Commit
22f24ec4
authored
Feb 18, 2016
by
Alessandro Rubini
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
syslog: report track-phase losses
Signed-off-by:
Alessandro Rubini
<
rubini@gnudd.com
>
parent
5380a0fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
0 deletions
+51
-0
syslog.c
lib/syslog.c
+51
-0
No files found.
lib/syslog.c
View file @
22f24ec4
...
...
@@ -66,6 +66,15 @@ int syslog_poll(void)
static
uint32_t
down_tics
;
int
len
=
0
;
/* for servo-state (accesses ppsi internal variables */
extern
struct
pp_instance
*
ppi
;
struct
wr_servo_state
*
s
=
&
((
struct
wr_data
*
)
ppi
->
ext_data
)
->
servo_state
;
static
uint32_t
prev_tics
;
static
int
track_ok_count
,
prev_servo_state
=
-
1
;
if
(
ip_status
==
IP_TRAINING
)
return
0
;
if
(
!
syslog_addr
.
daddr
)
...
...
@@ -101,6 +110,48 @@ int syslog_poll(void)
goto
send
;
}
if
(
!
prev_tics
)
prev_tics
=
timer_get_tics
();
if
(
s
->
state
==
WR_TRACK_PHASE
&&
prev_servo_state
!=
WR_TRACK_PHASE
)
{
/* we reached sync: log it */
track_ok_count
++
;
prev_servo_state
=
s
->
state
;
getIP
(
ip
);
shw_pps_gen_get_time
(
&
secs
,
NULL
);
prev_tics
=
timer_get_tics
()
-
prev_tics
;
if
(
track_ok_count
==
1
)
{
len
=
pp_sprintf
(
buf
+
UDP_END
,
"<14> %s %s Tracking after %i.%03i s
\n
"
,
format_time
(
secs
,
TIME_FORMAT_SYSLOG
),
format_ip
(
b1
,
ip
),
prev_tics
/
1000
,
prev_tics
%
1000
);
goto
send
;
}
len
=
pp_sprintf
(
buf
+
UDP_END
,
"<14> %s %s %i-th re-rtrack after %i.%03i s
\n
"
,
format_time
(
secs
,
TIME_FORMAT_SYSLOG
),
format_ip
(
b1
,
ip
),
track_ok_count
,
prev_tics
/
1000
,
prev_tics
%
1000
);
goto
send
;
}
if
(
s
->
state
!=
WR_TRACK_PHASE
&&
prev_servo_state
==
WR_TRACK_PHASE
)
{
prev_servo_state
=
s
->
state
;
getIP
(
ip
);
shw_pps_gen_get_time
(
&
secs
,
NULL
);
prev_tics
=
timer_get_tics
();
len
=
pp_sprintf
(
buf
+
UDP_END
,
"<14> %s %s Lost track
\n
"
,
format_time
(
secs
,
TIME_FORMAT_SYSLOG
),
format_ip
(
b1
,
ip
));
goto
send
;
}
return
0
;
send:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment