Commit c45dc11f authored by Mikael Ronstrom's avatar Mikael Ronstrom

merge Google changes to make it compile

parents 57787e8d 207225d5
...@@ -148,6 +148,21 @@ long innobase_max_merged_io = 64; ...@@ -148,6 +148,21 @@ long innobase_max_merged_io = 64;
/* Number of background IO threads for read and write. */ /* Number of background IO threads for read and write. */
long innobase_read_io_threads, innobase_write_io_threads; long innobase_read_io_threads, innobase_write_io_threads;
/* Max number of IO requests merged to perform large IO in background
IO threads.
*/
long innobase_max_merged_io = 64;
/* Number of background IO threads for read and write. */
long innobase_read_io_threads, innobase_write_io_threads;
/* Default number of IO per second supported by server. Tunes background
IO rate. */
static long innobase_io_capacity = 100;
/* Write dirty pages when pct dirty is less than max pct dirty */
static my_bool innobase_extra_dirty_writes = TRUE;
/* The following counter is used to convey information to InnoDB /* The following counter is used to convey information to InnoDB
about server activity: in selects it is not sensible to call about server activity: in selects it is not sensible to call
srv_active_wake_master_thread after each fetch or search, we only do srv_active_wake_master_thread after each fetch or search, we only do
......
...@@ -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. */
......
...@@ -330,6 +330,7 @@ mem_area_alloc( ...@@ -330,6 +330,7 @@ mem_area_alloc(
mem_pool_t* pool) /* in: memory pool */ mem_pool_t* pool) /* in: memory pool */
{ {
#ifdef UNIV_DISABLE_MEM_POOL #ifdef UNIV_DISABLE_MEM_POOL
(void)pool; /* Remove compiler warning */
return malloc(size); return malloc(size);
#else /* UNIV_DISABLE_MEM_POOL */ #else /* UNIV_DISABLE_MEM_POOL */
mem_area_t* area; mem_area_t* area;
...@@ -464,6 +465,7 @@ mem_area_free( ...@@ -464,6 +465,7 @@ mem_area_free(
mem_pool_t* pool) /* in: memory pool */ mem_pool_t* pool) /* in: memory pool */
{ {
#ifdef UNIV_DISABLE_MEM_POOL #ifdef UNIV_DISABLE_MEM_POOL
(void)pool; /* Remove compiler warning */
free(ptr); free(ptr);
#else /* UNIV_DISABLE_MEM_POOL */ #else /* UNIV_DISABLE_MEM_POOL */
mem_area_t* area; mem_area_t* area;
......
...@@ -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
} }
/*************************************************************************** /***************************************************************************
...@@ -3734,7 +3729,7 @@ os_aio_windows_handle( ...@@ -3734,7 +3729,7 @@ os_aio_windows_handle(
ut_a(slot->reserved); ut_a(slot->reserved);
if (orig_seg != ULINT_UNDEFINED) { if (global_segment != ULINT_UNDEFINED) {
srv_set_io_thread_op_info(orig_seg, srv_set_io_thread_op_info(orig_seg,
"get windows aio return value"); "get windows aio return value");
} }
......
...@@ -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);
} }
/************************************************************************* /*************************************************************************
......
...@@ -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;
} }
/************************************************************** /**************************************************************
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment