Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
6489b3b3
Commit
6489b3b3
authored
Oct 16, 2008
by
Mikael Ronstrom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A number of fixes of portability issues in Google patches
parent
c51c71a3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
31 deletions
+44
-31
storage/innobase/include/ut0ut.h
storage/innobase/include/ut0ut.h
+14
-2
storage/innobase/os/os0file.c
storage/innobase/os/os0file.c
+3
-8
storage/innobase/srv/srv0srv.c
storage/innobase/srv/srv0srv.c
+7
-19
storage/innobase/ut/ut0ut.c
storage/innobase/ut/ut0ut.c
+20
-2
No files found.
storage/innobase/include/ut0ut.h
View file @
6489b3b3
...
...
@@ -145,13 +145,25 @@ ib_time_t
ut_time
(
void
);
/*=========*/
/**************************************************************
Returns system time. */
Returns system time
in args, 0 on success
. */
void
int
ut_usectime
(
/*========*/
ulint
*
sec
,
/* out: seconds since the Epoch */
ulint
*
ms
);
/* out: microseconds since the Epoch+*sec */
/**************************************************************
Returns diff in microseconds (end_sec,end_ms) - (start_sec,start_ms). */
ib_longlong
ut_usecdiff
(
/*========*/
ulint
end_sec
,
/* in: seconds since the Epoch */
ulint
end_ms
,
/* in: microseconds since the Epoch+*sec1 */
ulint
start_sec
,
/* in: seconds since the Epoch */
ulint
start_ms
);
/* in: microseconds since the Epoch+*sec2 */
/**************************************************************
Returns the difference of two times in seconds. */
...
...
storage/innobase/os/os0file.c
View file @
6489b3b3
...
...
@@ -220,17 +220,12 @@ ulint os_file_n_pending_pwrites = 0;
ulint
os_n_pending_writes
=
0
;
ulint
os_n_pending_reads
=
0
;
/* TODO -- does InnoDB provide a portable method for this? */
static
double
time_usecs
()
{
#ifdef __WIN__
return
0
.
0
;
#else
struct
timeval
tv
;
if
(
gettimeofday
(
&
tv
,
NULL
))
ulint
sec
,
ms
;
if
(
ut_usectime
(
&
sec
,
&
ms
))
return
0
;
else
return
tv
.
tv_sec
*
1000000
.
0
+
tv
.
tv_usec
;
#endif
return
sec
*
1000000
.
0
+
ms
;
}
/***************************************************************************
...
...
storage/innobase/srv/srv0srv.c
View file @
6489b3b3
...
...
@@ -666,21 +666,6 @@ ulint srv_n_threads[SRV_MASTER + 1];
static
void
srv_reset_free_tickets
(
trx_t
*
trx
);
/*************************************************************************
Return the difference in microseconds between 'end' and 'start'
*/
static
ib_longlong
mics_diff
(
ulint
start_sec
,
ulint
start_usec
,
ulint
end_sec
,
ulint
end_usec
)
{
ib_longlong
end_mics
=
end_sec
*
1000000LL
+
end_usec
;
ib_longlong
start_mics
=
start_sec
*
1000000LL
+
start_usec
;
if
(
end_mics
>
start_mics
)
return
end_mics
-
start_mics
;
else
return
0
;
}
static
void
time_spin_delay
()
{
ulint
start_sec
,
end_sec
;
...
...
@@ -689,14 +674,17 @@ static void time_spin_delay()
srv_timed_spin_delay
=
0
;
ut_usectime
(
&
start_sec
,
&
start_usec
);
if
(
ut_usectime
(
&
start_sec
,
&
start_usec
))
return
;
for
(
i
=
0
;
i
<
SYNC_SPIN_ROUNDS
;
++
i
)
for
(
i
=
0
;
i
<
(
int
)
SYNC_SPIN_ROUNDS
;
++
i
)
ut_delay
(
ut_rnd_interval
(
0
,
srv_spin_wait_delay
));
ut_usectime
(
&
end_sec
,
&
end_usec
);
if
(
ut_usectime
(
&
end_sec
,
&
end_usec
))
return
;
srv_timed_spin_delay
=
mics_diff
(
start_sec
,
start_usec
,
end_sec
,
end_usec
);
srv_timed_spin_delay
=
ut_usecdiff
(
end_sec
,
end_usec
,
start_sec
,
start_usec
);
}
/*************************************************************************
...
...
storage/innobase/ut/ut0ut.c
View file @
6489b3b3
...
...
@@ -114,7 +114,7 @@ ut_time(void)
/**************************************************************
Returns system time. */
void
int
ut_usectime
(
/*========*/
ulint
*
sec
,
/* out: seconds since the Epoch */
...
...
@@ -122,9 +122,27 @@ ut_usectime(
{
struct
timeval
tv
;
ut_gettimeofday
(
&
tv
,
NULL
);
int
r
=
ut_gettimeofday
(
&
tv
,
NULL
);
*
sec
=
(
ulint
)
tv
.
tv_sec
;
*
ms
=
(
ulint
)
tv
.
tv_usec
;
return
r
;
}
/**************************************************************
Returns diff in microseconds (end_sec,end_ms) - (start_sec,start_ms) */
ib_longlong
ut_usecdiff
(
/*========*/
ulint
end_sec
,
/* in: seconds since the Epoch */
ulint
end_ms
,
/* in: microseconds since the Epoch+*sec1 */
ulint
start_sec
,
/* in: seconds since the Epoch */
ulint
start_ms
)
/* in: microseconds since the Epoch+*sec2 */
{
ib_longlong
end_mics
=
end_sec
*
1000000LL
+
end_ms
;
ib_longlong
start_mics
=
start_sec
*
1000000LL
+
start_ms
;
return
end_mics
-
start_mics
;
}
/**************************************************************
...
...
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