~ubuntu-branches/ubuntu/wily/net-snmp/wily-proposed

« back to all changes in this revision

Viewing changes to agent/mibgroup/host/hr_proc.c

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2010-06-28 14:59:36 UTC
  • mfrom: (1.2.3 upstream) (1.1.12 sid)
  • Revision ID: james.westby@ubuntu.com-20100628145936-cbiallic69pn044g
Tags: 5.4.3~dfsg-1ubuntu1
* Merge from debian unstable.  Remaining changes:
  - Set Ubuntu maintainer address.
  - net-snmp-config: Use bash. (LP: #104738)
  - Removed multiuser option when calling update-rc.d. (LP: #254261)
  - debian/snmpd.init: LSBify the init script.
  - debian/patches/52_fix_snmpcmd_1_typo.patch: Adjust a typo in snmpcmd.1
    (LP: #250459)
  - debian/snmpd.postinst: source debconf before doing work, LP: #589056
  - debian/snmp.preinst, debian/snmp.prerm: kill any/all processes owned by
    snmp user before install/uninstall, LP: #573391
  - Add apport hook (LP: #533603):
  - debian/{snmp,snmpd}.apport: Added.
  - debian/control: Build-depends on dh-apport.
  - debian/rules: 
    + Add --with apport.
    + override_dh_apport to install hook on snmpd package only.
 * Dropped patches:
   - debian/patches/99-fix-ubuntu-div0.patch: Fix dvision by zero.. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
175
175
        return (u_char *) nullOid;
176
176
    case HRPROC_LOAD:
177
177
        cpu = netsnmp_cpu_get_byIdx( proc_idx & HRDEV_TYPE_MASK, 0 );
178
 
        if ( !cpu || !cpu->history || !cpu->history[0].total_hist )
 
178
        if ( !cpu || !cpu->history || !cpu->history[0].total_hist ||
 
179
           ( cpu->history[0].total_hist == cpu->total_ticks ))
179
180
            return NULL;
180
181
 
181
182
        long_return  = (cpu->idle_ticks  - cpu->history[0].idle_hist)*100;
182
 
        long_return /= (cpu->total_ticks - cpu->history[0].total_hist);
 
183
        if (cpu->total_ticks > cpu->history[0].total_hist) /* avoid div. by 0 */
 
184
            long_return /= (cpu->total_ticks - cpu->history[0].total_hist);
 
185
        else
 
186
            long_return = 0; 
183
187
        long_return  = 100 - long_return;
184
188
        if (long_return < 0)
185
189
            long_return = 0;