ALT Linux Team development discussions
 help / color / mirror / Atom feed
From: Alexey Tourbin <at@altlinux.ru>
To: ALT Devel discussion list <devel@lists.altlinux.org>
Subject: Re: [devel] girar-builder FR: Выводить время в проверке на устанавливаемость.
Date: Fri, 15 May 2009 20:31:38 +0400
Message-ID: <20090515163138.GH10323@altlinux.org> (raw)
In-Reply-To: <20090515154543.GC18230@wo.int.altlinux.org>


[-- Attachment #1.1: Type: text/plain, Size: 4028 bytes --]

On Fri, May 15, 2009 at 07:45:43PM +0400, Dmitry V. Levin wrote:
> On Fri, May 15, 2009 at 09:26:27PM +0600, Andrey Rahmatullin wrote:
> > On Fri, May 15, 2009 at 01:25:33PM +0000, Sergey V Turchin wrote:
> > > Сборка закончилась примерно 14-May-2009 16:23
> > > task закончился примерно    15-May-2009 08:46
> > И чо оно так долго делало?
> 
> Тестировало установку 804 бинарных пакетов (15 часов 47 минут 03 секунды),
> в среднем около 70 секунд на 1 пакет (установка базового чрута, установка
> в него пакета со всеми его зависимостями, удаление чрута).

Я боюсь, что большую половину времени там на самом деле скушала
проверка, в которой используется --whatprovides.

$ hsh --init --no-stuff
...
$ hsh-run --rooter find / >$TMPDIR/out
find: /.out: Permission denied
find: /.host: Permission denied
$ time xargs --delimiter='\n' <$TMPDIR/out hsh-run --rooter -- rpmquery --whatprovides >/dev/null
warning: no package provides /
warning: no package provides /usr/share/info/autoconf.info.gz
warning: no package provides /usr/share/info/automake.info.gz
warning: no package provides /usr/share/man/man1/autoconf.1.gz
warning: no package provides /usr/share/man/man1/autoheader.1.gz
warning: no package provides /usr/share/man/man1/autom4te.1.gz
warning: no package provides /usr/share/man/man1/autoreconf.1.gz
warning: no package provides /usr/share/man/man1/autoscan.1.gz
warning: no package provides /usr/share/man/man1/autoupdate.1.gz
warning: no package provides /usr/share/man/man1/config.guess.1.gz
warning: no package provides /usr/share/man/man1/config.sub.1.gz
warning: no package provides /usr/share/man/man1/ifnames.1.gz
warning: no package provides /usr/bin/pydoc
warning: no package provides /usr/src/RPM
warning: no package provides /usr/src/RPM/RPMS
warning: no package provides /usr/src/RPM/RPMS/noarch
warning: no package provides /usr/src/RPM/SRPMS
warning: no package provides /usr/src/RPM/SPECS
warning: no package provides /usr/src/RPM/SOURCES
warning: no package provides /usr/src/RPM/BUILD
warning: no package provides /usr/src/.xsession.d
warning: no package provides /usr/src/.rpmmacros
...
warning: no package provides /dev
warning: no package provides /dev/log
warning: no package provides /dev/random
warning: no package provides /dev/urandom
warning: no package provides /dev/full
warning: no package provides /dev/zero
warning: no package provides /dev/null
error: file /dev/stderr: No such file or directory
error: file /dev/stdout: No such file or directory
error: file /dev/stdin: No such file or directory
error: file /dev/fd: No such file or directory
warning: no package provides /dev/pts
warning: no package provides /.in
warning: no package provides /.host
Command exited with non-zero status 123
95.34user 110.46system 4:21.10elapsed 78%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+12376937minor)pagefaults 0swaps
$

Одна из проблем со скоростью здесь в том, что rpmquery для каждого
аргумента всегда вынимает хедер из базы Packages, и для многих файлов
этот хедер, естественно, одинаковый.  То есть в цикле тупо вынимает один
и тот же хедер.

Я написал программу на Си, которая отличается от --whatprovides тем,
что работает чисто на индексе, а хедер не вынимает вообще.
Соответственно, это программа не умеет показывает, к чему файл
относится, но всё ещё умеет показывать, если файл никуда не относится.

Но оказывается, что эта программа не намного быстрее, даже не в два
раза.

$ time xargs --delimiter='\n' <$TMPDIR/out hsh-run --rooter -- ./qf-or-whatprovides-check
...
warning: file /.in is not owned by any package
warning: file /.host is not owned by any package
Command exited with non-zero status 123
76.30user 72.44system 3:31.91elapsed 70%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+7156556minor)pagefaults 0swaps
$ 

Значит, вынимание хедеров не является главным узким местом, как
я сначала думал.  Где-то ещё время утекает, надо будет профилировать.

[-- Attachment #1.2: qf-or-whatprovides-check.c --]
[-- Type: text/plain, Size: 935 bytes --]

#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <assert.h>
#include <rpmlib.h>
#include <rpmdb.h>

int check_index(rpmdb db, rpmTag tag, const char *str)
{
	rpmdbMatchIterator mi = rpmdbInitIterator(db, tag, str, 0);
	int count = rpmdbGetIteratorCount(mi);
	rpmdbFreeIterator(mi);
	return (count > 0) ? 0 : 1;
}

int qf_or_provides(rpmdb db, const char *path)
{
	if (check_index(db, RPMTAG_BASENAMES, path) == 0)
		return 0;
	if (check_index(db, RPMTAG_PROVIDENAME, path) == 0)
		return 0;
	struct stat st;
	if (lstat(path, &st) == 0)
		fprintf(stderr, "warning: file %s is not owned by any package\n", path);
	else
		fprintf(stderr, "error: file %s: %m\n", path);
	return 1;
}

int main(int argc, char *argv[])
{
	rpmdb db = NULL;
	rpmReadConfigFiles(NULL, NULL);
	rpmdbOpen(NULL, &db, O_RDONLY, 0644);
	assert(db);

	int i, rc = 0;
	for (i = 1; i < argc; i++)
		rc |= qf_or_provides(db, argv[i]);

	return rc;
}

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

  parent reply	other threads:[~2009-05-15 16:31 UTC|newest]

Thread overview: 105+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-14 18:55 Anton Farygin
2009-05-15 13:25 ` Sergey V Turchin
2009-05-15 15:26   ` Andrey Rahmatullin
2009-05-15 15:45     ` Dmitry V. Levin
2009-05-15 16:18       ` Michael Shigorin
2009-05-15 16:35         ` [devel] ресурсоёмкое тестирование пакетов Dmitry V. Levin
2009-05-15 17:23           ` Anton Farygin
2009-05-15 18:07             ` Alexey Tourbin
2009-05-15 18:15               ` Anton Farygin
2009-05-15 18:44                 ` Alexey Tourbin
2009-05-15 18:53                   ` Anton Farygin
2009-05-15 19:26                     ` Alexey Tourbin
2009-05-15 19:30                       ` Mikhail Gusarov
2009-05-15 19:55                         ` Alexey Tourbin
2009-05-15 19:58                           ` Mikhail Gusarov
2009-05-15 20:13                             ` Dmitry V. Levin
2009-05-15 20:13                             ` Alexey Tourbin
2009-05-15 21:10                           ` Afanasov Dmitry
2009-05-15 20:05                       ` Kirill A. Shutemov
2009-05-15 20:24                         ` Alexey Tourbin
2009-05-15 20:36                           ` Kirill A. Shutemov
2009-05-15 21:07                             ` Alexey Tourbin
2009-05-16  3:55                       ` Anton Farygin
2009-05-18 10:24                       ` Victor B. Wagner
2009-05-18 10:43                         ` Kirill A. Shutemov
2009-05-18 11:49                           ` Victor B. Wagner
2009-05-18 12:00                             ` Kirill A. Shutemov
2009-05-18 12:24                               ` Victor B. Wagner
2009-05-18 12:29                                 ` Kirill A. Shutemov
2009-05-18 12:48                                   ` Victor B. Wagner
2009-05-19  8:57                                     ` Alexey Rusakov
2009-05-19  9:36                                       ` Victor B. Wagner
2009-05-19 10:32                                       ` Anton Farygin
2009-05-19 14:00                                         ` Victor B. Wagner
2009-05-19 17:50                                         ` Alexey Tourbin
2009-05-20  5:41                                           ` Anton Farygin
2009-05-20 10:39                                             ` Dmitry V. Levin
2009-05-20 12:46                                             ` Alexey Tourbin
2009-05-18 12:49                                   ` Max Ivanov
2009-05-18 13:00                                     ` Kirill A. Shutemov
2009-05-18 13:19                                       ` Victor B. Wagner
2009-05-18 13:34                                     ` Alexey Tourbin
2009-05-18 13:43                                       ` Max Ivanov
2009-05-18 13:49                                         ` Andrey Rahmatullin
2009-05-18 13:52                                         ` Kirill A. Shutemov
2009-05-18 13:54                                         ` Alexey Tourbin
2009-05-26 20:34                                 ` Michael Shigorin
2009-05-26 21:53                                   ` [devel] [jt] " Dmitry V. Levin
2009-05-26 22:02                                     ` Mikhail Gusarov
2009-06-01 17:28                                       ` George V. Kouryachy
2009-06-01 17:32                                         ` Mikhail Gusarov
2009-06-01 18:34                                           ` George V. Kouryachy
2009-06-15 11:42                                   ` [devel] " Michael Shigorin
2009-05-19 14:13                           ` Afanasov Dmitry
2009-05-19 14:51                             ` Damir Shayhutdinov
2009-05-19 15:01                               ` Afanasov Dmitry
2009-05-20  6:53                                 ` Victor B. Wagner
2009-05-20  8:23                                   ` Damir Shayhutdinov
2009-05-20  8:24                                     ` Mikhail Gusarov
2009-05-20  9:07                                       ` Max Ivanov
2009-05-20  9:08                                         ` Mikhail Gusarov
2009-05-20  9:22                                           ` Kirill A. Shutemov
2009-05-20  9:24                                             ` Mikhail Gusarov
2009-05-20  9:32                                               ` Aleksey Novodvorsky
2009-05-20  9:35                                                 ` Mikhail Gusarov
2009-05-20 10:40                                                   ` Aleksey Novodvorsky
2009-05-20 10:44                                                     ` Dmitry V. Levin
2009-05-20  9:38                                               ` Kirill A. Shutemov
2009-05-20  9:41                                                 ` Mikhail Gusarov
2009-05-24 17:16                                                   ` [devel] [JT] BR drift (was: ресурсоёмкое тестирование пакетов) Michael Shigorin
2009-05-24 17:18                                                     ` [devel] [JT] BR drift Mikhail Gusarov
2009-05-24 19:56                                                       ` Michael Shigorin
2009-05-20  9:37                                             ` [devel] ресурсоёмкое тестирование пакетов Kirill Maslinsky
2009-05-20  9:39                                             ` Afanasov Dmitry
2009-05-20  9:41                                           ` Kirill Maslinsky
2009-05-20 10:02                                           ` Victor B. Wagner
2009-05-20 11:26                                             ` Mikhail Gusarov
2009-05-20 12:08                                               ` Damir Shayhutdinov
2009-05-20 12:20                                                 ` Kirill A. Shutemov
2009-05-20 12:22                                                   ` Andrey Rahmatullin
2009-05-20 12:34                                                   ` Damir Shayhutdinov
2009-05-20 12:38                                                     ` Kirill A. Shutemov
2009-05-21 15:07                                                       ` Igor Vlasenko
2009-05-20 12:48                                                     ` Alexey I. Froloff
2009-05-20 12:55                                                       ` Afanasov Dmitry
2009-05-20 14:56                                                   ` Victor B. Wagner
2009-05-20 14:59                                                     ` Mikhail Gusarov
2009-05-20 15:10                                                       ` Kirill A. Shutemov
2009-05-20 15:12                                                       ` Kirill A. Shutemov
2009-05-20 15:04                                                     ` Afanasov Dmitry
2009-05-21 15:02                                                       ` Igor Vlasenko
2009-05-21 15:17                                                         ` Afanasov Dmitry
2009-05-20 10:03                                       ` Dmitry V. Levin
2009-05-18 13:05                         ` Alexey Tourbin
2009-05-16  2:39                   ` Денис Смирнов
2009-05-15 18:32           ` Afanasov Dmitry
2009-05-15 18:33             ` Anton Farygin
2009-05-15 18:42               ` Afanasov Dmitry
2009-05-15 18:46                 ` Anton Farygin
2009-05-15 18:34             ` Michael Shigorin
2009-05-15 18:36               ` Afanasov Dmitry
2009-05-15 18:38                 ` Anton Farygin
2009-05-15 16:31       ` Alexey Tourbin [this message]
2009-05-16 15:17       ` [devel] girar-builder FR: Выводить время в проверке на устанавливаемость Timur Batyrshin
2009-05-16 15:24         ` Dmitry V. Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090515163138.GH10323@altlinux.org \
    --to=at@altlinux.ru \
    --cc=devel@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Team development discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git