Skip to content

Commit 494a209

Browse files
authored
Merge pull request #2081 from LinuxCNC/minor-fixes
Minor fixes
2 parents 518348c + 1abc0ac commit 494a209

3 files changed

Lines changed: 25 additions & 9 deletions

File tree

src/hal/components/threads.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ RTAPI_MP_LONG(period2, "thread2 period (nsecs)");
7272
static char *name3 = NULL; /* name of thread */
7373
RTAPI_MP_STRING(name3, "name of thread 3");
7474
static int fp3 = 1; /* use floating point? default = yes */
75-
RTAPI_MP_INT(fp3, "thread1 uses floating point");
75+
RTAPI_MP_INT(fp3, "thread3 uses floating point");
7676
static long period3 = 0; /* thread period - default = no thread */
7777
RTAPI_MP_LONG(period3, "thread3 period (nsecs)");
7878

src/hal/components/timedelta.comp

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
11
component timedelta "LinuxCNC HAL component that measures thread scheduling timing behavior";
2-
pin out s32 out;
3-
pin out s32 err=0;
4-
pin out s32 min_=0;
5-
pin out s32 max_=0;
6-
pin out s32 jitter=0;
7-
pin out float avg_err=0;
8-
pin in bit reset;
2+
3+
pin out s32 jitter=0 "Worst-case scheduling error (in ns). This is the largest discrepancy between ideal thread period, and actual time between sequential runs of this component. This uses the absolute value of the error, so 'got run too early' and 'got run too late' both show up as positive jitter.";
4+
5+
pin out s32 current_jitter=0 "Scheduling error (in ns) of the current invocation. This is the discrepancy between ideal thread period, and actual time since the previous run of this component. This uses the absolute value of the error, so 'got run too early' and 'got run too late' both show up as positive jitter.";
6+
7+
pin out s32 current_error=0 "Scheduling error (in ns) of the current invocation. This is the discrepancy between ideal thread period, and actual time since the previous run of this component. This does not use the absolute value of the error, so 'got run too early' shows up as negative error and 'got run too late' shows up as positive error.";
8+
9+
pin out s32 min_=0 "Minimum time (in ns) between sequential runs of this component.";
10+
11+
pin out s32 max_=0 "Maximum time (in ns) between sequential runs of this component.";
12+
13+
pin in bit reset "Set this pin to True, then back to False, to reset some of the statistics.";
14+
15+
pin out s32 out "Time (in ns) since the previous run of this component. This should ideally be equal to the thread period.";
16+
17+
pin out s32 err=0 "Cumulative time error (in ns). Probably not useful.";
18+
19+
pin out float avg_err=0 "The average scheduling error (in ns).";
20+
21+
922
function _ nofp;
1023
variable rtapi_s64 last=0;
1124
variable int first=1;
@@ -30,6 +43,8 @@ if(last != 0) {
3043
if(del < min_) min_ = del;
3144
if(del > max_) max_ = del;
3245
jitter = max(max_ - period, period - min_);
46+
current_jitter = max(del - period, period - del);
47+
current_error = del - period;
3348
}
3449
count++;
3550
avg_err = err / (double)count;

src/rtapi/uspace_rtapi_app.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,8 @@ static int master(int fd, vector<string> args) {
458458
perror("pthread_create (queue function)");
459459
return -1;
460460
}
461-
do_load_cmd("hal_lib", vector<string>()); instance_count = 0;
461+
do_load_cmd("hal_lib", vector<string>());
462+
instance_count = 0;
462463
App(); // force rtapi_app to be created
463464
int result=0;
464465
if(args.size()) {

0 commit comments

Comments
 (0)