2
0
mirror of https://github.com/lm-sensors/lm-sensors synced 2025-09-05 08:45:26 +00:00
Commit Graph

95 Commits

Author SHA1 Message Date
Jean Delvare
eb5cf8b2ec Update my e-mail address and copyright years 2014-03-20 10:23:35 +00:00
Jean Delvare
8b4299252b Bumb libsensors version, part 2 2014-01-29 09:28:08 +00:00
Jean Delvare
883f4e49a3 libsensors: Get rid of arbitrary limit on per-type sensor count
When gathering the attributes of each hwmon chip, libsensors uses a
temporary structure in memory to order and group all the attributes
into features. This temporary structure used to be a single array with
room for every possible attribute/subfeature. While simple, this
approach required to predefine a maximum number of per-type sensor
that could be handled.

In order to get rid of this arbitrary limit, which we hit and had to
raise three times already, I changed the temporary structure to an
array of dynamically allocated per-type subattribute arrays. This lets
us not allocate any memory for types which aren't implemented by a
given chip, and more importantly, this lets us reallocate room for
more attributes of a given type as needed.

I decided to allocate chunks of 8 attributes at a time, as this seemed
a good compromise between two frequent reallocations and
over-provisioning. It could be tweaked if needed.

Icing on the cake, I benchmarked this change on two different systems
and it results in performance gains. The total heap usage as reported
by valgrind is down by 50% on average, with peak memory consumption
(as reported by valgrind's massif) also down by 43% on average. The
total instructions count (as reported by valgrind's callgrind) is down
by 11% on average, with measured execution time also down by a few
percents. Valgrind rocks, BTW.

I have some ideas to optimize the memory allocations further, but I do
not expect such a huge gain from them. They may not even improve peak
memory consumption as massif shows the peak is somewhere else now at
least in some cases.
2014-01-29 09:25:31 +00:00
Jean Delvare
ae877a1e55 Prepare for release.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6035 7894878c-1315-0410-8ee3-d5d059ff63e0
2012-03-14 07:43:39 +00:00
Jean Delvare
a3e40509e0 Add support for fan[1-*]_max, fan[1-*]_min_alarm and fan[1-*]_max_alarm
attributes. These are defined in the standard sysfs interface for quite
some time, and at least three drivers (max6650, lm63 and applesmc)
implement them so we should support them.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6029 7894878c-1315-0410-8ee3-d5d059ff63e0
2012-03-06 07:34:13 +00:00
Guenter Roeck
273102f2c9 Add support for additional sysfs attributes to libsensors and to sensors command
inX_average
inX_lowest
inX_highest
tempX_lowest
tempX_highest
currX_average
currX_lowest
currX_highest




git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@6007 7894878c-1315-0410-8ee3-d5d059ff63e0
2012-01-09 17:30:10 +00:00
Jean Delvare
159cceaa24 Prepare for release.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5949 7894878c-1315-0410-8ee3-d5d059ff63e0
2011-03-28 07:02:37 +00:00
Guenter Roeck
eaf86b0c49 Added support for SENSORS_SUBFEATURE_FAN_PULSES to libsensors.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5938 7894878c-1315-0410-8ee3-d5d059ff63e0
2011-03-04 20:37:43 +00:00
Guenter Roeck
c618c56023 Added support for humidity sensors to libsensors
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5918 7894878c-1315-0410-8ee3-d5d059ff63e0
2011-02-13 18:55:09 +00:00
Guenter Roeck
fb325cf089 Add support for recently added sysfs ABI attributes
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5917 7894878c-1315-0410-8ee3-d5d059ff63e0
2011-02-09 19:25:22 +00:00
Guenter Roeck
443b54b325 Added support for new sysfs attributes
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5898 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-12-14 20:26:27 +00:00
Jean Delvare
ff0bfc174d Compute MAX_*_SENSOR_TYPES at build time (#2378).
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5897 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-12-14 09:09:42 +00:00
Jean Delvare
05a24e5bb2 libsensors: Add support for intrusion detection.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5879 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-11-03 13:00:59 +00:00
Jean Delvare
f292e9f408 Prepare for release.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5863 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-10-10 19:15:54 +00:00
Jean Delvare
e369e65d42 Change libsensors license from GPL to LGPL.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5844 7894878c-1315-0410-8ee3-d5d059ff63e0
2010-07-01 11:56:42 +00:00
Jean Delvare
7c37bd44ac Add support for HID devices.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5786 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-10-18 12:05:16 +00:00
Jean Delvare
78f496ca62 libsensors: New method to free the memory allocated for the internal
representation of chip names.
sensord, sensors: Fix a memory leak when one or more chip names are
provided on the command line.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5740 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-06-20 10:04:52 +00:00
Jean Delvare
0ffa44331c Set library version to 4.1.0.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@5663 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-02-25 07:47:13 +00:00
Hans de Goede
11eec21555 Add ACPI bus
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5593 7894878c-1315-0410-8ee3-d5d059ff63e0
2009-01-13 08:06:32 +00:00
Jean Delvare
51a621be43 Add support for current sensors.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5379 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-10-24 09:04:26 +00:00
Jean Delvare
d766935c47 Add support for instantaneous power sensors.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5378 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-10-24 09:03:18 +00:00
Darrick J. Wong
bb840c486c Subject: [PATCH 1/3 v3] libsensors: Support energy and power meters
Add power and sensor meters to libsensors, with minor tweaks and
documentation updates as suggested by Jean Delvare.

Signed-off-by: Darrick J. Wong <djwong@us.ibm.com>



git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5183 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-04-17 01:27:22 +00:00
Jean Delvare
fdd8139afc Trivial alignment fix.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5177 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-04-14 15:29:49 +00:00
Jean Delvare
39b96fa477 Add support for virtual hwmon devices. This closes Red Hat bug #437637
and ticket #2305.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5176 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-04-14 15:27:59 +00:00
Jean Delvare
f2e518511d Patch from Aurelien Jarno:
I have just noticed that the FSF address is the old one in all files
except COPYING. Please find a patch below to fix that.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@5163 7894878c-1315-0410-8ee3-d5d059ff63e0
2008-03-26 13:37:12 +00:00
Hans de Goede
0aee76dbbb make SENSORS_API_VERSION hexadecimal
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4978 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-10-22 19:27:38 +00:00
Hans de Goede
2c41310ba0 add SENSORS_API_VERSION define to sensors.h
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4975 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-10-22 09:39:15 +00:00
Jean Delvare
01c2d7d046 SENSORS_NO_MAPPING is no longer used, delete it.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4871 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-24 11:22:24 +00:00
Jean Delvare
55a29cc2ce Reserve some room in struct sensors_feature for future extension.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4859 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 17:48:57 +00:00
Jean Delvare
d1b374cc38 Renumber feature and subfeature types to leave more room if we later
need to add more feature or subfeature types.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4858 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 17:42:27 +00:00
Jean Delvare
e01466d993 New public library function: sensors_get_subfeature(). Applications can
use it to retrieve a specific subfeature by type. While it is slighly
less efficient than looping over sensors_get_all_subfeatures(), it
often makes the application code much more elegant.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4846 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:30:28 +00:00
Jean Delvare
da7b4e48da Introduce a separate type for main features. Make subfeatures map to
the real main feature rather than the first subfeature.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4838 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:16:50 +00:00
Jean Delvare
65f1d1f1cd Rename subfeature types from *_FEATURE_* to *_SUBFEATURE_*, to better
reflect what they represent.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4837 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:12:19 +00:00
Jean Delvare
e13c11d353 Update the comments and symbols in the whole library code to refer to
features and subfeatures as appropriate.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4836 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:07:53 +00:00
Jean Delvare
96c914bfda Define a separate structure to represent main features. This allows
for faster main features lookup. One side effect of this change is
that subfeatures can no longer have labels nor be ignored. I do not
think that this is a problem in practice, and actually this makes a
lot of sense.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4834 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:05:16 +00:00
Jean Delvare
79086fb7b8 Rename struct sensors_feature_data to sensors_subfeature. This is a
first step towards a clean separation between main features and
subfeatures.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4832 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:02:22 +00:00
Jean Delvare
eba601a964 Split sensors_get_all_features() into two distinct functions, one to
get the list of all main features, and one to get the list of all the
subfeatures of a given main feature. This is a more logical interface for
applications to use. The current implementation is admittedly less than
optimal, because the storage structures weren't meant for it, but this
issue can (and will) be addressed later.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4831 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 12:00:59 +00:00
Jean Delvare
08a686e3cc sensors_feature_data and sensors_chip_feature are now the exact
same structure, so we can get rid of the former for simpler code.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4830 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-23 11:59:51 +00:00
Jean Delvare
9cf1330eb0 Add support for beep features.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4826 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-20 21:23:19 +00:00
Jean Delvare
61686376df Add support for temperature offset files, which are part of the
standard sysfs interface. I don't think it makes much sense to
display the offset values as part of the output of "sensors" (it
would even probably confuse people) but having support for these
in libsensors makes it possible to adjust the offsets in
sensors.conf, which is convenient.

This closes ticket #2248.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4769 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-05 12:31:12 +00:00
Jean Delvare
6c4ea89ab9 Renumber SENSORS_FEATURE_VID from 0x300 to 0x1000. If we ever need
to add more "standard" feature types such as current or power,
we want to give them numbers that immediately follow the fan, voltage
and temperature features, so that the code is as simple as possible.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4767 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-05 12:29:20 +00:00
Jean Delvare
29bea1e843 Add support for the standard beep_enable attribute (#2248).
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4766 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-05 12:28:31 +00:00
Jean Delvare
20c98f41b7 The compute mapping value is either SENSORS_NO_MAPPING or the same
feature number as the logical mapping. This means that the compute
mapping can be turned into a simple boolean flag. Doing so makes
struct sensors_feature_data smaller, which saves some memory (about
17 kB in my tests.)


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4758 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-05 08:17:22 +00:00
Jean Delvare
87efbc06c5 Rename sensors_feature_data.mode to flags, as we plan to use it to
store non-mode flags soon.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4757 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-09-05 08:13:15 +00:00
Jean Delvare
a82c6b0476 Mass reindent, coding style and whitespace cleanups.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4736 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-31 14:42:20 +00:00
Jean Delvare
c00e21cf38 Reorder the members of the structures sensors_feature_data and
sensors_bus_id. This prevents wasting space with padding on 64-bit
systems, saving some memory (128 bytes for sensors_bus_id, nothing
yet for sensors_feature_data but it will come later).


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4733 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-30 21:23:22 +00:00
Jean Delvare
b491ba49d4 Make SENSORS_FEATURE_MAX_SUB_FEATURES private (and rename it to
MAX_SUB_FEATURES in the process.) This value could change in the
future so it's not safe to make it part of the libsensors API.
And it isn't needed either, applications shouldn't need to use
this value.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4732 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-30 21:21:15 +00:00
Jean Delvare
5b1068a007 Rename SENSORS_FEATURE_TEMP_SENS to SENSORS_FEATURE_TEMP_TYPE. This
better reflects what this feature is, in line with the sysfs file name.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4730 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-29 14:08:47 +00:00
Jean Delvare
a9a48ea2a9 Make sensors_match_chip internal to libsensors. It is no longer used by
applications in practice.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4702 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-26 08:26:51 +00:00
Jean Delvare
4d6bec8bb2 Add a parameter to sensors_get_detected_chips(), to optionally let the
caller select which subset of chips it wants. This is slightly better
size-wise than letting all applications do the filtering by themselves.

This will change the way the command line parameters of "sensors" are
interpreted. Beforehand, the chips were always returned in the order
in which they were listed by the library. Also, each chip could be listed
only once. From now on, the chips will be listed in the order in which
they are passed on the command line, which I think makes more sense. A
side effect is that chips can be listed more than once, if that's what
the user asks for. Not very useful though.

This change makes it possible to make sensors_match_chip() internal
to the library. Filtering the list of chips returned by
sensors_get_detected_chips() was the last known external use for this
function.

This patch looks much bigger than it really is, but the largest part is
really only code reindentation.


git-svn-id: http://lm-sensors.org/svn/lm-sensors/branches/lm-sensors-3.0.0@4701 7894878c-1315-0410-8ee3-d5d059ff63e0
2007-08-26 08:26:20 +00:00