Hi!

I wrote some python modules for Ganglia 3.1.2, I have one question.

In my python code:

  "value_type": "uint",

see output of gmond:

  $ nc TARGETHOST 8649
  ...
  <METRIC NAME="XXX" VAL="136" TYPE="uint32" ...

so I understand that "uint" in python code is treated as "uint32" in gmond.

I sent very big number (just like over 2147483648 (2G)) by my python
modules, but I got another number (rounded?) from gmond.


hmm.. so I read source code of Ganglia 3.1.2 and found cast from
unsigned long to unsigned int.

code from "ganglia-3.1.2/gmond/modules/python/mod_python.c":

...
        case GANGLIA_VALUE_UNSIGNED_INT:
        {
            unsigned int v = 0;
            get_python_uint_value(pobj, &v); // HERE
            val.uint32 = v;
            break;
        }
...

...
int
get_python_uint_value(PyObject* dv, unsigned int* pint)
{
    int cc = 1;
    if (PyInt_Check(dv) || PyLong_Check(dv)) {
        unsigned long v = PyInt_AsUnsignedLongMask(dv);
        *pint = (unsigned int)v;             // HERE
    }
..


Why not return unsigned long straight insted of casted unsigned int?

Thanks.

-- 
HIROSE, Masaaki

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Ganglia-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ganglia-general

Reply via email to