List:Internals« Previous MessageNext Message »
From:Matthew Boehm Date:April 13 2011 7:51pm
Subject:Re: accessing status variables
View as plain text  
Hi Sergei,
I would like to use fill_status() as it seems to fit my requirement 
best. My idea being I pass an empty table structure to fill_status() and 
let it fill in all the global status variables. Then return to my daemon 
function and simply iterate through the table for what I need.

However, the prototype for fill_status() asks for THD and TABLE_LIST 
variables. Being a daemon plugin inside mysql, I'm not sure I have a thd 
I can access. I figured I would be able to say something like "self" to 
represent my own thread but I don't think that's the same thing.

I've looked through the code a bit for an instantiation example of THD 
and TABLE_LIST but to no avail.

Where should I look for this? Or do you have an example of instancing each?

Thanks,
Matthew


On 3/1/11 7:17 AM, Sergei Golubchik wrote:
> 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