From: Michael R. <re...@eu...> - 2004-06-17 06:35:26
|
Hi there, We do have some performance issues with the current lcd4linux, especially the netdev and diskstats plugin. The reason is that both plugins read a lot of values (there are many lines in these two proc files, every line with many columns). The plugins used to split every line into peaces, calling hash_set (or even worse: hash_set_delta) for every value. However, most of the values were never used.... I rewrote the hash handling to solve this issues. The result has been just checked in. Please try to test some (or all) of the plugins, if they still work. Some implementation details: - new function 'hash_create(&HASH)': initializes a hash table - new function 'hash_set_column()': allows you to specifiy column headers - new function 'hash_set_delimiter()': allows you to specify column delimiting chars - hash_set() and hash_set_delta() have been renamed to hash_put() - hash_age() lost its 3rd parameter (as it has never been used) The new handling allows you to go old-style, by using hash_put() and hash_get_delta, with a 'column' parameter of NULL. If you want to save cpu cycles, you would no longer split a line into pieces and call hash_put() for every value, but save the line as a whole with one hash_put() call. Beforehand, you should specify column headers (or column names) and the delimiting characters. After that, you can use hash_get() or hash_get_delta() with a column name as a parameter, and the hash subsystem will extract only this needed value from the line. Take a look at plugin_diskstats(), where the new handling is used. plugin_netdev has been modified so it compiles cleanly, but has not been switched to the new time-saving handling. Have fun, Michael -- Michael Reinelt Tel: +43 676 3079941 Geisslergasse 4 Fax: +43 316 692343 A-8045 Graz, Austria e-mail: re...@eu... |