[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#398381: marked as done (apt: Is extremely slow because calls gettimeofday too much)



Your message dated Thu, 07 Dec 2006 16:17:02 +0000
with message-id <E1GsLvi-0006fL-B0@ries.debian.org>
and subject line Bug#398381: fixed in apt 0.6.46.4
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: apt
Version: 0.6.46.3
Severity: important
Tags: patch


The "Building dependency tree..." takes an extremely long time on
may arm machine.  Firther investigation shows this is spending most of
its time in gettimeofday(), which is quite a slow function on this
machine.

apt calls OpProgress::CheckChange very frequently during this process.
Estimates from a faster machine indicate it is called many thousands of times.
Consider the case where we have just completed the first 1% progress.
CheckChange is called, and the value to be displayed is different, so we
call gettimeofday to figure out how log ago that was. It wasn't very
long (< 0.7 sec), so we return false. Note that LastPercent is not
modified.  After the next extremely small piece of work we the same is
still true.  We continue making extremely slow progress, spending most
of our time in gettimeofday.  After 0.7 seconds has passed we return
true and update LastPercent.  Annother 0.9%ish occurs quickly because
CheckChange returns immediately, until we get to 3% complete, at which
point we start calling gettimeofday again.

Thus the whole process takes well over a minute instead of a few
seconds.

On a other machines the same occurs, but gettimeofday is sufficiently fast
that calling it 25 thousand times isn't so noticable.

The patch below modifies CheckChange to only try and update update when
the progress crosses a percentage boundary, rather than when 1% progress
since the last update.

Only updating when crossing a boundry means that under extreme
circumstances the displayed value may lag behind the actual state by one
update.  Under normal curcumstances (slow or steady progress) the
displayed value will be just as accurate.  It's only a progress bar :-)

On my amd64 machine the patch reduces the time taken to run
"apt-get install apt" from 0.33 sec to 0.27 sec.
On my slower arm machine it goes from 55 sec to 28 sec.

Paul

diff -ur apt/apt-pkg/contrib/progress.cc apt/apt-pkg/contrib/progress.cc
--- apt-clean/apt-pkg/contrib/progress.cc	2006-03-02 14:27:13
+++ apt-0.6.46.3/apt-pkg/contrib/progress.cc	2006-11-13 02:20:39
@@ -116,6 +116,8 @@
    if ((int)LastPercent == (int)Percent)
       return false;
    
+   LastPercent = Percent;
+
    if (Interval == 0)
       return false;
    
@@ -126,6 +128,5 @@
    if (Diff < Interval)
       return false;
    LastTime = Now;   
-   LastPercent = Percent;
    return true;
 }


-- Package-specific info:

-- (no /etc/apt/preferences present) --
-- (/etc/apt/sources.list present, but not submitted) --

-- System Information:
Debian Release: 4.0
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.16-2-xen-amd64-k8
Locale: LANG=en_GB, LC_CTYPE=en_GB (charmap=ISO-8859-1)

Versions of packages apt depends on:
ii  debian-archive-keyring       2006.01.18  GnuPG archive keys of the Debian a
ii  libc6                        2.3.6.ds1-7 GNU C Library: Shared libraries
ii  libgcc1                      1:4.1.1-19  GCC support library
ii  libstdc++6                   4.1.1-19    The GNU Standard C++ Library v3

apt recommends no packages.

-- no debconf information


--- End Message ---
--- Begin Message ---
Source: apt
Source-Version: 0.6.46.4

We believe that the bug you reported is fixed in the latest version of
apt, which is due to be installed in the Debian FTP archive:

apt-doc_0.6.46.4_all.deb
  to pool/main/a/apt/apt-doc_0.6.46.4_all.deb
apt-utils_0.6.46.4_i386.deb
  to pool/main/a/apt/apt-utils_0.6.46.4_i386.deb
apt_0.6.46.4.dsc
  to pool/main/a/apt/apt_0.6.46.4.dsc
apt_0.6.46.4.tar.gz
  to pool/main/a/apt/apt_0.6.46.4.tar.gz
apt_0.6.46.4_i386.deb
  to pool/main/a/apt/apt_0.6.46.4_i386.deb
libapt-pkg-dev_0.6.46.4_i386.deb
  to pool/main/a/apt/libapt-pkg-dev_0.6.46.4_i386.deb
libapt-pkg-doc_0.6.46.4_all.deb
  to pool/main/a/apt/libapt-pkg-doc_0.6.46.4_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 398381@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Michael Vogt <mvo@debian.org> (supplier of updated apt package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Thu,  7 Dec 2006 10:49:50 +0100
Source: apt
Binary: apt-utils libapt-pkg-doc libapt-pkg-dev apt-doc apt
Architecture: source all i386
Version: 0.6.46.4
Distribution: unstable
Urgency: high
Maintainer: APT Development Team <deity@lists.debian.org>
Changed-By: Michael Vogt <mvo@debian.org>
Description: 
 apt        - Advanced front-end for dpkg
 apt-doc    - Documentation for APT
 apt-utils  - APT utility programs
 libapt-pkg-dev - Development files for APT's libapt-pkg and libapt-inst
 libapt-pkg-doc - Documentation for APT development
Closes: 398381 400874 401017
Changes: 
 apt (0.6.46.4) unstable; urgency=high
 .
   * ack NMU (closes: #401017)
   * added apt-secure.8 to "See also" section
   * apt-pkg/deb/dpkgpm.cc:
     - added "Dpkg::StopOnError" variable that controls if apt
       will abort on errors from dpkg
   * apt-pkg/deb/debsrcrecords.{cc,h}:
     - make the Buffer grow dynmaically (closes: #400874)
   * Merged from Christian Perrier bzr branch:
     - uk.po: New Ukrainian translation: 483t28f3u
     - el.po: Update to 503t9f2u
     - de.po: Updates and corrections.
   * apt-pkg/contrib/progress.cc:
     - OpProgress::CheckChange optimized, thanks to Paul Brook
       (closes: #398381)
   * apt-pkg/contrib/sha256.cc:
     - fix building with noopt
Files: 
 22f6d1c960f5d57263487f6d57dfc57a 788 admin important apt_0.6.46.4.dsc
 82ec892fb9d389a4b6090cc2314e1714 1797347 admin important apt_0.6.46.4.tar.gz
 ab4bd0d33e5112129f4a6fddb30ef051 91468 doc optional apt-doc_0.6.46.4_all.deb
 8b24eafb11eb630306462f77a380b300 113052 doc optional libapt-pkg-doc_0.6.46.4_all.deb
 61aa2370fdd1dd47bdd9a9d4edcf0366 1445796 admin important apt_0.6.46.4_i386.deb
 c6a3bea824c613e787a1a500706a3f1b 84084 libdevel optional libapt-pkg-dev_0.6.46.4_i386.deb
 aedda4fa178a4a05a917cb1df54ceb67 199198 admin important apt-utils_0.6.46.4_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (GNU/Linux)

iD8DBQFFdGNQliSD4VZixzQRAkL1AJ9vw7rECsmRh3DpC+YH/9DHKzQfiwCglZN/
rOSnKrnTPdK5CCm9tuP7f1A=
=t/Se
-----END PGP SIGNATURE-----


--- End Message ---

Reply to: