MCPcopy Create free account
hub / github.com/MariaDB/server / add_to_status

Function add_to_status

sql/sql_class.cc:1978–2023  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1976*/
1977
1978void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var)
1979{
1980 ulong *end= (ulong*) ((uchar*) to_var +
1981 offsetof(STATUS_VAR, last_system_status_var) +
1982 sizeof(ulong));
1983 ulong *to= (ulong*) to_var, *from= (ulong*) from_var;
1984
1985 while (to != end)
1986 *(to++)+= *(from++);
1987
1988 /*
1989 Handle the not ulong variables. See end of system_status_var
1990 */
1991 to_var->bytes_received+= from_var->bytes_received;
1992 to_var->bytes_sent+= from_var->bytes_sent;
1993 to_var->rows_read+= from_var->rows_read;
1994 to_var->rows_sent+= from_var->rows_sent;
1995 to_var->rows_tmp_read+= from_var->rows_tmp_read;
1996 to_var->binlog_bytes_written+= from_var->binlog_bytes_written;
1997 to_var->cpu_time+= from_var->cpu_time;
1998 to_var->busy_time+= from_var->busy_time;
1999 to_var->table_open_cache_hits+= from_var->table_open_cache_hits;
2000 to_var->table_open_cache_misses+= from_var->table_open_cache_misses;
2001 to_var->table_open_cache_overflows+= from_var->table_open_cache_overflows;
2002 to_var->query_time+= from_var->query_time;
2003
2004 /*
2005 Update global_memory_used. We have to do this with atomic_add as the
2006 global value can change outside of LOCK_status.
2007 Note that local_memory_used is handled in calc_sum_callback().
2008 */
2009 if (to_var == &global_status_var)
2010 {
2011 DBUG_PRINT("info", ("global memory_used: %lld size: %lld",
2012 (longlong) global_status_var.global_memory_used,
2013 (longlong) from_var->global_memory_used));
2014 update_global_memory_status(from_var->global_memory_used);
2015 /* global_tmp_space_used is always kept up to date */
2016 to_var->tmp_space_used= global_tmp_space_used;
2017 }
2018 else
2019 {
2020 to_var->global_memory_used+= from_var->global_memory_used;
2021 to_var->tmp_space_used+= from_var->tmp_space_used;
2022 }
2023}
2024
2025/*
2026 Add the difference between two status variable arrays to another one.

Callers 4

refresh_session_statusFunction · 0.70
refresh_status_legacyFunction · 0.70
add_status_to_globalMethod · 0.70
calc_sum_callbackFunction · 0.70

Calls 1

Tested by

no test coverage detected