[yast-devel] RFC: showy2log ported to perl, 20x speedup of pretty-print, some changes
Hi, the pretty-print functionality of "y2tool showy2log -v", which shows lists and maps in YaST log files in a readable way, is quite slow on logs with long and complicated lines. On my current, fast machine it can take some, 5, 10, 15 minutes or more to run through the log file produced by a YaST2 installation. On my previous machine it could even take up to 2 hours. I ported showy2log from awk to perl. My testing shows an average speedup of about 20 times with the new implementation. I suggest replacing showy2log in yast2-devtools with the new implementation. What do you think? There are two changes from the previous implementation: - the pattern match against the YaST component in a log line seems to have been broken; the new showy2log now matches against the correct part of a log line - the accepting pattern match against the whole log line would only work if an accepting pattern match against the log level and/or the YaST component was used as well; this is fixed The new showy2log can be found as an attachment to this mail. Comments please. :) Regards, Olaf P.S. if you wander what "pretty-print" does: it shows data in a line like this: 2007-05-29 11:30:40 <1> linux(3288) [YCP] StorageDevices.ycp:448 localProbe: all_disks [$["bios_id":"0x80", "bus":"IDE", "bus_hwcfg":"ide", "class_id":262, "detail":$["channel":0, "host":0, "id":0, "lun":0], "dev_name":"/dev/sda", "dev_names":["/dev/sda", "/dev/disk/by-id/scsi-SATA_FUJITSU_MHN2300_NH64T2114M4K", "/dev/disk/by-id/ata-FUJITSU_MHN2300AT_NH64T2114M4K", "/dev/disk/by-path/pci-0000:00:11.1-scsi-0:0:0:0", "/dev/disk/by-id/edd-int13_dev80"], "dev_num":$["major":8, "minor":0, "range":16, "type":"b"], "device":"MHN2300A", "driver":"pata_via", "driver_module":"pata_via", "model":"FUJITSU MHN2300A", "old_unique_key":"MUqY.6Z5mBUxKxnC", "parent_unique_key":"+Y+h.mcsZ0a690T4", "resource":$["disk_log_geo":[$["cylinders":3648, "heads":255, "sectors":63]], "size":[$["unit":"sectors", "x":58605120, "y":512]]], "rev":"7256", "sub_class_id":0, "sysfs_bus_id":"0:0:0:0", "udi":"/org/freedesktop/Hal/devices/storage_serial_SATA_FUJITSU_MHN2300_NH64T2114M4K", "unique_key":"z70z.IHepsuGPoS8", "vendor":"FUJITSU"]] in a readable way like this: 2007-05-29 11:30:40 <1> linux(3288) [YCP] StorageDevices.ycp:448 localProbe: all_disks [ $[ "bios_id":"0x80", "bus":"IDE", "bus_hwcfg":"ide", "class_id":262, "detail":$[ "channel":0, "host":0, "id":0, "lun":0 ], "dev_name":"/dev/sda", "dev_names":[ "/dev/sda", "/dev/disk/by-id/scsi-SATA_FUJITSU_MHN2300_NH64T2114M4K", "/dev/disk/by-id/ata-FUJITSU_MHN2300AT_NH64T2114M4K", "/dev/disk/by-path/pci-0000:00:11.1-scsi-0:0:0:0", "/dev/disk/by-id/edd-int13_dev80" ], "dev_num":$[ "major":8, "minor":0, "range":16, "type":"b" ], "device":"MHN2300A", "driver":"pata_via", "driver_module":"pata_via", "model":"FUJITSU MHN2300A", "old_unique_key":"MUqY.6Z5mBUxKxnC", "parent_unique_key":"+Y+h.mcsZ0a690T4", "resource":$[ "disk_log_geo":[ $[ "cylinders":3648, "heads":255, "sectors":63 ] ], "size":[ $[ "unit":"sectors", "x":58605120, "y":512 ] ] ], "rev":"7256", "sub_class_id":0, "sysfs_bus_id":"0:0:0:0", "udi":"/org/freedesktop/Hal/devices/storage_serial_SATA_FUJITSU_MHN2300_NH64T2114M4K", "unique_key":"z70z.IHepsuGPoS8", "vendor":"FUJITSU" ] ] At least for yast2-bootloader it is essential that we can read these data structures during development and debugging. Regards, -- Olaf Dabrunz (od/odabrunz), SUSE Linux Products GmbH, Nürnberg
That's great! I like that "pretty-print" output (for big maps I used to use vim) Michal -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
On 05-Aug-07, Michal Zugec wrote:
That's great! I like that "pretty-print" output (for big maps I used to use vim)
Thanks a lot. :) I also got positive feedback from HuHa (sh@suse.de), and as nobody objects, I will submit the sped-up showy2log on top of the old version in STABLE then. -- Olaf Dabrunz (od/odabrunz), SUSE Linux Products GmbH, Nürnberg -- To unsubscribe, e-mail: yast-devel+unsubscribe@opensuse.org For additional commands, e-mail: yast-devel+help@opensuse.org
participants (2)
-
Michal Zugec
-
Olaf Dabrunz