List:Internals« Previous MessageNext Message »
From:Sergei Golubchik Date:March 1 2011 3:17pm
Subject:Re: accessing status variables
View as plain text  
Hi, Matthew!

On Feb 21, Matthew Boehm wrote:
> Hello all,
> From within a plug-in, what's the best/correct way to access all the
> status variables that are visible from 'SHOW GLOBAL STATUS'?
>
> I've included the mysql_priv.h header file in my plugin which gives me
> access to "global_status_var" and "status_vars[]". Is it safe for me
> to read their values at any point?
>
> I was planning on writing a simple for-loop to iterate through
> status_vars[]. Or is there something else that already does this and
> gives the values of each element?

You'll need to take the corresponding mutex, and take into account
than an entry in the global_status_var[] array may refer to another
array (SHOW_ARRAY) or to a function (SHOW_FUNC).

All this is already implemented in the server, of course.
See fill_status() and show_status_array() in sql_show.cc.

Regards,
Sergei
Thread
accessing status variablesMatthew Boehm21 Feb
  • Re: accessing status variablesSergei Golubchik1 Mar
    • Re: accessing status variablesMatthew Boehm13 Apr
      • Re: accessing status variablesSergei Golubchik19 Apr