Skip to content
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

Open
wants to merge 9 commits into
base: Matvii.Zorin
Choose a base branch
from
Open

timer #12

wants to merge 9 commits into from

Conversation

matthewzorin
Copy link

Merge solution for the third lesson homework. May need to add README.md file

	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
Comment on lines 45 to 53
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);
Copy link
Contributor

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?

Copy link
Author

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

Copy link
Contributor

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.

@yekovalyov yekovalyov added question Further information is requested and removed ready for review labels Feb 6, 2020
	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]>
@matthewzorin matthewzorin added enhancement New feature or request ready for review labels Feb 8, 2020
done
make uninstall

exit $RETURN_SUCCESS
Copy link
Contributor

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?

Copy link
Author

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

Copy link
Contributor

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.

Copy link
Author

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.

timer/timer.c Outdated Show resolved Hide resolved
Signed-off-by: Zorin Matvii <[email protected]>
Signed-off-by: Zorin Matvii <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants