Commit 1bd13ed
tracing/hist: Add poll(POLLIN) support on hist file
Add poll syscall support on the `hist` file. The Waiter will be waken
up when the histogram is updated with POLLIN.
Currently, there is no way to wait for a specific event in userspace.
So user needs to peek the `trace` periodicaly, or wait on `trace_pipe`.
But it is not a good idea to peek at the `trace` for an event that
randomly happens. And `trace_pipe` is not coming back until a page is
filled with events.
This allows a user to wait for a specific event on the `hist` file. User
can set a histogram trigger on the event which they want to monitor
and poll() on its `hist` file. Since this poll() returns POLLIN, the next
poll() will return soon unless a read() happens on that hist file.
NOTE: To read the hist file again, you must set the file offset to 0,
but just for monitoring the event, you may not need to read the
histogram.
Cc: Shuah Khan <shuah@kernel.org>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Link: https://lore.kernel.org/173527247756.464571.14236296701625509931.stgit@devnote2
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Reviewed-by: Tom Zanussi <zanussi@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>1 parent 22bec11 commit 1bd13ed
3 files changed
Lines changed: 95 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
673 | 673 | | |
674 | 674 | | |
675 | 675 | | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
676 | 690 | | |
677 | 691 | | |
678 | 692 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3094 | 3094 | | |
3095 | 3095 | | |
3096 | 3096 | | |
| 3097 | + | |
| 3098 | + | |
| 3099 | + | |
| 3100 | + | |
| 3101 | + | |
| 3102 | + | |
| 3103 | + | |
| 3104 | + | |
| 3105 | + | |
| 3106 | + | |
| 3107 | + | |
| 3108 | + | |
| 3109 | + | |
| 3110 | + | |
3097 | 3111 | | |
3098 | 3112 | | |
3099 | 3113 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5311 | 5311 | | |
5312 | 5312 | | |
5313 | 5313 | | |
| 5314 | + | |
| 5315 | + | |
5314 | 5316 | | |
5315 | 5317 | | |
5316 | 5318 | | |
| |||
5590 | 5592 | | |
5591 | 5593 | | |
5592 | 5594 | | |
| 5595 | + | |
| 5596 | + | |
| 5597 | + | |
| 5598 | + | |
| 5599 | + | |
| 5600 | + | |
| 5601 | + | |
| 5602 | + | |
| 5603 | + | |
| 5604 | + | |
| 5605 | + | |
| 5606 | + | |
| 5607 | + | |
| 5608 | + | |
| 5609 | + | |
| 5610 | + | |
| 5611 | + | |
| 5612 | + | |
| 5613 | + | |
| 5614 | + | |
5593 | 5615 | | |
5594 | 5616 | | |
| 5617 | + | |
5595 | 5618 | | |
5596 | 5619 | | |
5597 | 5620 | | |
5598 | 5621 | | |
5599 | 5622 | | |
5600 | 5623 | | |
5601 | | - | |
| 5624 | + | |
5602 | 5625 | | |
5603 | 5626 | | |
5604 | 5627 | | |
5605 | 5628 | | |
5606 | 5629 | | |
5607 | 5630 | | |
5608 | 5631 | | |
| 5632 | + | |
| 5633 | + | |
5609 | 5634 | | |
5610 | 5635 | | |
5611 | 5636 | | |
| 5637 | + | |
| 5638 | + | |
| 5639 | + | |
| 5640 | + | |
| 5641 | + | |
| 5642 | + | |
| 5643 | + | |
| 5644 | + | |
| 5645 | + | |
| 5646 | + | |
| 5647 | + | |
| 5648 | + | |
| 5649 | + | |
| 5650 | + | |
| 5651 | + | |
| 5652 | + | |
| 5653 | + | |
| 5654 | + | |
| 5655 | + | |
| 5656 | + | |
| 5657 | + | |
| 5658 | + | |
| 5659 | + | |
| 5660 | + | |
| 5661 | + | |
| 5662 | + | |
| 5663 | + | |
| 5664 | + | |
| 5665 | + | |
5612 | 5666 | | |
5613 | 5667 | | |
| 5668 | + | |
5614 | 5669 | | |
5615 | 5670 | | |
5616 | 5671 | | |
5617 | 5672 | | |
5618 | 5673 | | |
5619 | 5674 | | |
| 5675 | + | |
| 5676 | + | |
| 5677 | + | |
| 5678 | + | |
| 5679 | + | |
5620 | 5680 | | |
5621 | 5681 | | |
5622 | | - | |
| 5682 | + | |
| 5683 | + | |
| 5684 | + | |
| 5685 | + | |
5623 | 5686 | | |
5624 | 5687 | | |
5625 | 5688 | | |
5626 | 5689 | | |
5627 | 5690 | | |
5628 | 5691 | | |
5629 | | - | |
| 5692 | + | |
| 5693 | + | |
5630 | 5694 | | |
5631 | 5695 | | |
5632 | 5696 | | |
| |||
0 commit comments