Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 925192 Details for
Bug 1128200
ps -p uses huge amount of syscalls and system time
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
sketch of a patch to fix this performance issue
procps-ps-selection-by-pid.patch (text/plain), 2.95 KB, created by
Arthur Nascimento
on 2014-08-08 14:47:56 UTC
(
hide
)
Description:
sketch of a patch to fix this performance issue
Filename:
MIME Type:
Creator:
Arthur Nascimento
Created:
2014-08-08 14:47:56 UTC
Size:
2.95 KB
patch
obsolete
>--- procps-3.2.7-a/ps/display.c 2014-08-07 21:30:58.000000000 -0300 >+++ procps-3.2.7-c/ps/display.c 2014-08-07 23:03:10.000000000 -0300 >@@ -202,6 +202,31 @@ > return needs; > } > >+ >+/***** compare function for qsort on pid_t */ >+static int compare_two_pid_t(const void *a, const void *b){ >+ pid_t A = *((pid_t *) a); >+ pid_t B = *((pid_t *) b); >+ if (A < B) >+ return -1; >+ if (A > B) >+ return 1; >+ return 0; >+} >+ >+/***** set the selection method */ >+/* 0 to iterate through all /proc and PROC_PID to iterate through a pid_t list*/ >+static unsigned set_selection_method(selection_node * walk){ >+ if (all_processes || simple_select || !walk) >+ return 0; >+ while(walk){ >+ if (walk->typecode != SEL_PID) >+ return 0; >+ walk = walk->next; >+ } >+ return PROC_PID; >+} >+ > /***** check needs */ > /* see what files need to be read, etc. */ > static unsigned collect_format_needs(format_node *walk){ >@@ -215,9 +240,11 @@ > > static format_node *proc_format_list; > static format_node *task_format_list; >+static pid_t *pids = NULL; > > static unsigned needs_for_threads; > static unsigned needs_for_sort; >+static unsigned selection_method; > static unsigned proc_format_needs; > static unsigned task_format_needs; > >@@ -274,6 +301,35 @@ > > needs_for_sort = check_sort_needs(sort_list); > >+ selection_method = set_selection_method(selection_list); >+ if (selection_method) { >+ /* count pids provided + 1 */ >+ int count = 1, pos = 0, i; >+ selection_node *p = selection_list; >+ while (p) { >+ if (p->typecode == SEL_PID) >+ count += p->n; >+ p = p->next; >+ } >+ pids = (pid_t *) malloc(count * sizeof(pid_t)); >+ p = selection_list; >+ while (p) { >+ if (p->typecode == SEL_PID) { >+ for (i = 0; i < p->n; i++) >+ pids[pos++] = p->u[i].pid; >+ } >+ p = p->next; >+ } >+ pids[pos] = (pid_t) 0; >+ qsort(pids, count - 1, sizeof(pid_t), compare_two_pid_t); >+ for (pos = 0, i = 1; i < count - 1; i++) { >+ if (pids[pos] != pids[i]) >+ pos++; >+ pids[pos] = pids[i]; >+ } >+ pids[pos+1] = 0; >+ } >+ > // move process-only flags to the process > proc_format_needs |= (task_format_needs &~ PROC_ONLY_FLAGS); > task_format_needs &= ~PROC_ONLY_FLAGS; >@@ -328,7 +384,8 @@ > static void simple_spew(void){ > proc_t buf; > PROCTAB* ptp; >- ptp = openproc(needs_for_format | needs_for_sort | needs_for_select | needs_for_threads); >+ >+ ptp = openproc(needs_for_format | needs_for_sort | needs_for_select | needs_for_threads | selection_method, pids); > if(!ptp) { > fprintf(stderr, "Error: can not access /proc.\n"); > exit(1); >@@ -520,7 +577,7 @@ > PROCTAB *restrict ptp; > int n = 0; /* number of processes & index into array */ > >- ptp = openproc(needs_for_format | needs_for_sort | needs_for_select | needs_for_threads); >+ ptp = openproc(needs_for_format | needs_for_sort | needs_for_select | needs_for_threads | selection_method, pids); > if(!ptp) { > fprintf(stderr, "Error: can not access /proc.\n"); > exit(1);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1128200
:
925191
| 925192