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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
207225d5
Commit
207225d5
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
d7de0b17
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 @
207225d5
...
@@ -145,13 +145,25 @@ ib_time_t
...
@@ -145,13 +145,25 @@ ib_time_t
ut_time
(
void
);
ut_time
(
void
);
/*=========*/
/*=========*/
/**************************************************************
/**************************************************************
Returns system time. */
Returns system time
in args, 0 on success
. */
void
int
ut_usectime
(
ut_usectime
(
/*========*/
/*========*/
ulint
*
sec
,
/* out: seconds since the Epoch */
ulint
*
sec
,
/* out: seconds since the Epoch */
ulint
*
ms
);
/* out: microseconds since the Epoch+*sec */
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. */
Returns the difference of two times in seconds. */
...
...
storage/innobase/os/os0file.c
View file @
207225d5
...
@@ -220,17 +220,12 @@ ulint os_file_n_pending_pwrites = 0;
...
@@ -220,17 +220,12 @@ ulint os_file_n_pending_pwrites = 0;
ulint
os_n_pending_writes
=
0
;
ulint
os_n_pending_writes
=
0
;
ulint
os_n_pending_reads
=
0
;
ulint
os_n_pending_reads
=
0
;
/* TODO -- does InnoDB provide a portable method for this? */
static
double
time_usecs
()
{
static
double
time_usecs
()
{
#ifdef __WIN__
ulint
sec
,
ms
;
return
0
.
0
;
if
(
ut_usectime
(
&
sec
,
&
ms
))
#else
struct
timeval
tv
;
if
(
gettimeofday
(
&
tv
,
NULL
))
return
0
;
return
0
;
else
else
return
tv
.
tv_sec
*
1000000
.
0
+
tv
.
tv_usec
;
return
sec
*
1000000
.
0
+
ms
;
#endif
}
}
/***************************************************************************
/***************************************************************************
...
...
storage/innobase/srv/srv0srv.c
View file @
207225d5
...
@@ -666,21 +666,6 @@ ulint srv_n_threads[SRV_MASTER + 1];
...
@@ -666,21 +666,6 @@ ulint srv_n_threads[SRV_MASTER + 1];
static
void
srv_reset_free_tickets
(
trx_t
*
trx
);
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
()
static
void
time_spin_delay
()
{
{
ulint
start_sec
,
end_sec
;
ulint
start_sec
,
end_sec
;
...
@@ -689,14 +674,17 @@ static void time_spin_delay()
...
@@ -689,14 +674,17 @@ static void time_spin_delay()
srv_timed_spin_delay
=
0
;
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_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 @
207225d5
...
@@ -114,7 +114,7 @@ ut_time(void)
...
@@ -114,7 +114,7 @@ ut_time(void)
/**************************************************************
/**************************************************************
Returns system time. */
Returns system time. */
void
int
ut_usectime
(
ut_usectime
(
/*========*/
/*========*/
ulint
*
sec
,
/* out: seconds since the Epoch */
ulint
*
sec
,
/* out: seconds since the Epoch */
...
@@ -122,9 +122,27 @@ ut_usectime(
...
@@ -122,9 +122,27 @@ ut_usectime(
{
{
struct
timeval
tv
;
struct
timeval
tv
;
ut_gettimeofday
(
&
tv
,
NULL
);
int
r
=
ut_gettimeofday
(
&
tv
,
NULL
);
*
sec
=
(
ulint
)
tv
.
tv_sec
;
*
sec
=
(
ulint
)
tv
.
tv_sec
;
*
ms
=
(
ulint
)
tv
.
tv_usec
;
*
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