Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
ALICIA YAP ZI QI
OSKernel2024-X
Commits
e873a4ea
Commit
e873a4ea
authored
5 months ago
by
pku2402010330
Browse files
Options
Download
Patches
Plain Diff
debug sleep
parent
59d83fbd
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
kernel/sysproc.c
+3
-1
kernel/sysproc.c
with
3 additions
and
1 deletion
+3
-1
kernel/sysproc.c
+
3
−
1
View file @
e873a4ea
...
...
@@ -259,8 +259,10 @@ sys_nanosleep(void)
time0
=
time
;
acquire
(
&
tickslock
);
uint64
target_ticks
=
tv_sec
*
TICKS_PER_SECOND
+
(
tv_nsec
*
TICKS_PER_SECOND
)
/
1000000000
;
// Include nanoseconds in the sleep time calculation
while
(
time
-
time0
<
t
v_sec
*
TICKS_PER_SECOND
+
tv_nsec
/
(
1000000000
/
TICKS_PER_SECOND
)
)
{
while
(
time
-
time0
<
t
arget_ticks
)
{
printf
(
"time = %llu, time0 = %llu, tv_sec = %llu, tv_nsec = %llu
\n
"
,
time
,
time0
,
tv_sec
,
tv_nsec
);
printf
(
"Sleeping... Time elapsed: %llu, target: %llu
\n
"
,
time
-
time0
,
tv_sec
*
TICKS_PER_SECOND
+
tv_nsec
/
(
1000000000
/
TICKS_PER_SECOND
));
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets