Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logic bug in cache_nvidia_string_value_update() #2022

Merged
merged 3 commits into from
Aug 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/nvidia.cc
Original file line number Diff line number Diff line change
Expand Up @@ -829,11 +829,12 @@ void cache_nvidia_string_value_update(nvidia_c_string *ac_string, char *token,
ac_string[gid].memTransferRatemax < 0) {
ac_string[gid].memTransferRatemax = *value;

} else if (strcmp(token, (char *)"perf") == 0 &&
ac_string[gid].memTransferRatemax < 0) {
if (search == SEARCH_MIN) {
} else if (strcmp(token, (char *)"perf") == 0) {
if (search == SEARCH_MIN &&
ac_string[gid].perfmin < 0) {
ac_string[gid].perfmin = *value;
} else if (search == SEARCH_MAX) {
} else if (search == SEARCH_MAX &&
ac_string[gid].perfmax < 0) {
ac_string[gid].perfmax = *value;
}
}
Expand Down Expand Up @@ -1164,7 +1165,7 @@ double get_nvidia_barval(struct text_object *obj) {
temp2 = get_nvidia_string_value(nvs->target, ATTR_PERFMODES_STRING,
(char *)"memTransferRatemax",
SEARCH_MAX, nvs->target_id, nvs->arg);
if (temp2 > temp1) temp1 = temp2; // extra safe here
if (temp1 > temp2) temp1 = temp2; // extra safe here
value = ((float)temp1 * 100 / (float)temp2) + 0.5;
break;
case ATTR_IMAGE_QUALITY: // imagequality
Expand Down
Loading