-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
timer #12
base: Matvii.Zorin
Are you sure you want to change the base?
timer #12
Conversation
Add sysfs class, read attribute Add Makefile and format file Signed-off-by: Zorin Matvii <[email protected]>
Add test script and log file Signed-off-by: Zorin Matvii <[email protected]>
Add simple script for checking the high resolution timer state Add sysfs read interface Signed-off-by: Zorin Matvii <[email protected]>
Remove useless callback function and its adding to hrtimer structure Signed-off-by: Zorin Matvii <[email protected]>
timer/timer.c
Outdated
len = snprintf(hr_sec, MAX_HR_BUFF, "%lld", time); | ||
if (len > DOT_POS && len < MAX_HR_BUFF - 1) { | ||
size_t i; | ||
for (i = len - 1; i > len - DOT_POS; --i) { | ||
hr_sec[i + 1] = hr_sec[i]; | ||
} | ||
hr_sec[len - DOT_POS] = '.'; | ||
} | ||
sprintf(buffer, "time = %s s\n", hr_sec); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the reason for timer printing redesign?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ktime_t store value in nanoseconds. So, for getting time string in seconds, I have used this string conversion. Before I was getting the same via division and modulo operations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you simplify this code? I think previous implementation was better.
Replace the time value conversion from kernel module to bash script Remove plain text from showing in sysfs interfaces Signed-off-by: Zorin Matvii <[email protected]>
Show absolute time of previous reading (before was current) Signed-off-by: Zorin Matvii <[email protected]>
timer/timer_test.sh
Outdated
done | ||
make uninstall | ||
|
||
exit $RETURN_SUCCESS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the value of RETURN_SUCCESS?
Is this exit required?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's just code style in this example. exit $RETURN_SUCCESS directly indicates the end of script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose that using uninitialized variables is not good practice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed this unnecessary exit call.
Signed-off-by: Zorin Matvii <[email protected]>
Signed-off-by: Zorin Matvii <[email protected]>
Signed-off-by: Zorin Matvii <[email protected]>
Merge solution for the third lesson homework. May need to add README.md file