summaryrefslogtreecommitdiff
path: root/libudev/test-libudev.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2009-07-08 02:04:49 +0200
committerKay Sievers <kay.sievers@vrfy.org>2009-07-08 02:04:49 +0200
commit871a36bd7e37a9d27e633b93ae0119a4553195ec (patch)
tree2bd56b520e33bb26f1182baf7bfc17baa4feda1f /libudev/test-libudev.c
parenta71369b0db359cddeb207a317588b175630dcca8 (diff)
libudev: enumerate - sort with qsort()
On machines with many thousands of devices: $ time find /sys -name uevent | wc -l 74876 real 0m33.171s user 0m3.329s sys 0m29.719s the current udevtrigger spends minutes sorting the device list: $ time /sbin/udevadm trigger --dry-run real 4m56.739s user 4m45.743s sys 0m7.862s with qsort() it looks better: $ time udev/udevadm trigger --dry-run real 0m6.495s user 0m0.473s sys 0m5.923s
Diffstat (limited to 'libudev/test-libudev.c')
-rw-r--r--libudev/test-libudev.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libudev/test-libudev.c b/libudev/test-libudev.c
index db08d4845f..34b3de86f1 100644
--- a/libudev/test-libudev.c
+++ b/libudev/test-libudev.c
@@ -329,6 +329,26 @@ static int test_enumerate(struct udev *udev, const char *subsystem)
test_enumerate_print_list(udev_enumerate);
udev_enumerate_unref(udev_enumerate);
+ printf("enumerate 'net' + duplicated scan + null + zero\n");
+ udev_enumerate = udev_enumerate_new(udev);
+ if (udev_enumerate == NULL)
+ return -1;
+ udev_enumerate_add_match_subsystem(udev_enumerate, "net");
+ udev_enumerate_scan_devices(udev_enumerate);
+ udev_enumerate_scan_devices(udev_enumerate);
+ udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero");
+ udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null");
+ udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero");
+ udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null");
+ udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero");
+ udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null");
+ udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/null");
+ udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero");
+ udev_enumerate_add_syspath(udev_enumerate, "/sys/class/mem/zero");
+ udev_enumerate_scan_devices(udev_enumerate);
+ test_enumerate_print_list(udev_enumerate);
+ udev_enumerate_unref(udev_enumerate);
+
printf("enumerate 'block'\n");
udev_enumerate = udev_enumerate_new(udev);
if (udev_enumerate == NULL)