64-bit-net-tx-net-rx.patch

Simon Boulet, 11/30/2012 03:45 AM

Download (5.12 KB)

View differences:

opennebula-3.8.1/include/ObjectXML.h 2012-11-29 22:27:33.000000000 -0500
97 97
    /**
98 98
     *  Gets and sets a xpath attribute, if the attribute is not found a default
99 99
     *  is used
100
     *    @param value to set 
101
     *    @param xpath_expr of the xml element
102
     *    @param def default value if the element is not found
103
     *
104
     *    @return -1 if default was set
105
     */
106
    int xpath(long long& value, const char * xpath_expr,
107
              const long long& def);
108

  
109
    /**
110
     *  Gets and sets a xpath attribute, if the attribute is not found a default
111
     *  is used
112
     *    @param value to set 
113
     *    @param xpath_expr of the xml element
114
     *    @param def default value if the element is not found
115
     *
116
     *    @return -1 if default was set
117
     */
118
    int xpath(unsigned long long& value, const char * xpath_expr,
119
              const unsigned long long& def);
120

  
121
    /**
122
     *  Gets and sets a xpath attribute, if the attribute is not found a default
123
     *  is used
100 124
     *    @param value to set
101 125
     *    @param xpath_expr of the xml element
102 126
     *    @param def default value if the element is not found
opennebula-3.8.1/include/VirtualMachine.h 2012-11-29 22:37:50.000000000 -0500
173 173
     *   @param _memory Kilobytes used by the VM (total)
174 174
     *   @param _cpu used by the VM (rate)
175 175
     *   @param _net_tx transmitted bytes (total)
176
     *   @param _net_tx received bytes (total)
176
     *   @param _net_rx received bytes (total)
177 177
     */
178 178
    void update_info(
179 179
        const int _memory,
180 180
        const int _cpu,
181
        const int _net_tx,
182
        const int _net_rx)
181
        const long long _net_tx,
182
        const long long _net_rx)
183 183
    {
184 184
        if (_memory != -1)
185 185
        {
......
950 950
    /**
951 951
     *  Network usage, transmitted bytes
952 952
     */
953
    int         net_tx;
953
    long long   net_tx;
954 954

  
955 955
    /**
956 956
     *  Network usage, received bytes
957 957
     */
958
    int         net_rx;
958
    long long   net_rx;
959 959

  
960 960
    /**
961 961
     *  History record, for the current host
opennebula-3.8.1/src/vmm/VirtualMachineManagerDriver.cc 2012-11-29 22:06:31.000000000 -0500
386 386

  
387 387
            int             cpu    = -1;
388 388
            int             memory = -1;
389
            int             net_tx = -1;
390
            int             net_rx = -1;
389
            long long       net_tx = -1;
390
            long long       net_rx = -1;
391 391
            char            state  = '-';
392 392

  
393 393
            string monitor_str = is.str();
opennebula-3.8.1/src/xml/ObjectXML.cc 2012-11-29 22:27:47.000000000 -0500
222 222
/* -------------------------------------------------------------------------- */
223 223
/* -------------------------------------------------------------------------- */
224 224

  
225
int ObjectXML::xpath(long long& value, const char * xpath_expr,
226
                     const long long& def)
227
{
228
    vector<string> values;
229
    int rc = 0;
230

  
231
    values = (*this)[xpath_expr];
232

  
233
    if (values.empty() == true)
234
    {
235
        value = def;
236
        rc = -1;
237
    }
238
    else
239
    {
240
        istringstream iss;
241

  
242
        iss.str(values[0]);
243

  
244
        iss >> dec >> value;
245

  
246
        if (iss.fail() == true)
247
        {
248
            value = def;
249
            rc    = -1;
250
        }
251
    }
252

  
253
    return rc;
254
}
255

  
256
/* -------------------------------------------------------------------------- */
257
/* -------------------------------------------------------------------------- */
258

  
259
int ObjectXML::xpath(unsigned long long& value, const char * xpath_expr,
260
                     const unsigned long long& def)
261
{
262
    vector<string> values;
263
    int rc = 0;
264

  
265
    values = (*this)[xpath_expr];
266

  
267
    if (values.empty() == true)
268
    {
269
        value = def;
270
        rc = -1;
271
    }
272
    else
273
    {
274
        istringstream iss;
275

  
276
        iss.str(values[0]);
277

  
278
        iss >> dec >> value;
279

  
280
        if (iss.fail() == true)
281
        {
282
            value = def;
283
            rc    = -1;
284
        }
285
    }
286

  
287
    return rc;
288
}
289

  
290
/* -------------------------------------------------------------------------- */
291
/* -------------------------------------------------------------------------- */
292

  
225 293
int ObjectXML::xpath(time_t& value, const char * xpath_expr, const time_t& def)
226 294
{
227 295
    int int_val;