From: Jaroslav Skarvada <jskarvad at redhat.com>
To: powertop@lists.01.org
Subject: [Powertop] patch: tell user if the system is running out of FDs
Date: Thu, 19 Sep 2013 11:23:21 -0400 [thread overview]
Message-ID: <808108042.17411093.1379604201988.JavaMail.root@redhat.com> (raw)
In-Reply-To: 1812437942.17407873.1379603934162.JavaMail.root@redhat.com
[-- Attachment #1: Type: text/plain, Size: 209 bytes --]
Hi,
complex servers can run out of FDs easily (due to perf).
In such case tell user that more FDs are needed instead
of the generic message (that kernel doesn't support
the perf)
regards
Jaroslav
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: powertop-2.4-fd-limit-err.patch --]
[-- Type: text/x-patch, Size: 1510 bytes --]
diff -up powertop-2.4/src/perf/perf.cpp.orig powertop-2.4/src/perf/perf.cpp
--- powertop-2.4/src/perf/perf.cpp.orig 2013-01-31 16:39:27.000000000 -0500
+++ powertop-2.4/src/perf/perf.cpp 2013-09-19 10:36:02.298839248 -0400
@@ -26,6 +26,7 @@
#include <iostream>
#include <fstream>
+#include <errno.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
@@ -72,6 +73,7 @@ void perf_event::create_perf_event(char
{
struct perf_event_attr attr;
int ret;
+ int err;
struct {
__u64 count;
@@ -107,10 +109,15 @@ void perf_event::create_perf_event(char
perf_fd = sys_perf_event_open(&attr, -1, _cpu, -1, 0);
if (perf_fd < 0) {
+ err = errno;
reset_display();
- fprintf(stderr, _("PowerTOP %s needs the kernel to support the 'perf' subsystem\n"), POWERTOP_VERSION);
- fprintf(stderr, _("as well as support for trace points in the kernel:\n"));
- fprintf(stderr, "CONFIG_PERF_EVENTS=y\nCONFIG_PERF_COUNTERS=y\nCONFIG_TRACEPOINTS=y\nCONFIG_TRACING=y\n");
+ if (err == EMFILE)
+ fprintf(stderr, _("Too many open files, please increase the limit of open file descriptors.\n"));
+ else {
+ fprintf(stderr, _("PowerTOP %s needs the kernel to support the 'perf' subsystem\n"), POWERTOP_VERSION);
+ fprintf(stderr, _("as well as support for trace points in the kernel:\n"));
+ fprintf(stderr, "CONFIG_PERF_EVENTS=y\nCONFIG_PERF_COUNTERS=y\nCONFIG_TRACEPOINTS=y\nCONFIG_TRACING=y\n");
+ }
exit(EXIT_FAILURE);
}
if (read(perf_fd, &read_data, sizeof(read_data)) == -1) {
next reply other threads:[~2013-09-19 15:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-19 15:23 Jaroslav Skarvada [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-09-19 20:41 [Powertop] patch: tell user if the system is running out of FDs Sergey Senozhatsky
2013-10-07 13:12 Jaroslav Skarvada
2013-10-07 14:05 Sergey Senozhatsky
2013-10-08 12:08 Jaroslav Skarvada
2013-10-08 12:49 Sergey Senozhatsky
2013-10-08 12:56 Jaroslav Skarvada
2013-10-08 13:21 Sergey Senozhatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=808108042.17411093.1379604201988.JavaMail.root@redhat.com \
--to=powertop@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.