You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mesos.apache.org by "Jie Yu (JIRA)" <ji...@apache.org> on 2015/04/03 19:38:54 UTC

[jira] [Comment Edited] (MESOS-2590) Let the slave control the duration of the perf sampler instead of relying on a sleep command.

    [ https://issues.apache.org/jira/browse/MESOS-2590?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14393659#comment-14393659 ] 

Jie Yu edited comment on MESOS-2590 at 4/3/15 5:37 PM:
-------------------------------------------------------

OK, I took a shot today and ran into an issue I don't quite understand:

This works fine as expected:
{noformat:title=console1}
[root@xxx ~]# perf stat -a -x, --log-fd 1 --pid 10940 --event cycles,task-clock
{noformat}

{noformat:title=console2}
kill -s SIGINT <pid_of_perf>
{noformat}

{noformat:title=console1}
[root@xxx ~]# perf stat -a -x, --log-fd 1 --pid 10940 --event cycles,task-clock
301291813,cycles
153.144374,task-clock

{noformat}

However, when I coded it, I wasn't able to read anything from stdout pipe after the perf subprocess was signaled and terminated. During the debugging, I did the following experiments. The following is not expected:

{noformat:title=console1}
[root@xxx ~]# perf stat -a -x, --output tmp --pid 10940 --event cycles,task-clock
{noformat}

{noformat:title=console2}
kill -s SIGINT <pid_of_perf>
{noformat}

{noformat:title=console1}
[root@xxx ~]# cat tmp
{noformat}

However, the following is expected:

{noformat:title=console1}
[root@xxx ~]# perf stat -a -x, --output tmp --pid 10940 --event cycles,task-clock -- sleep 1
[root@xxx ~]# cat tmp
# started on Thu Apr  2 22:40:09 2015

27932118,cycles
14.807048,task-clock
{noformat}

Anyone has any idea? Looks like shell's piping allows us to get the output correctly after receiving SIGINT while the file based redirection does not allow us to get the output correctly (This is also true for our subprocess stdout pipe).


was (Author: jieyu):
OK, I took a shot today and ran into an issue I don't quite understand:

This works fine as expected:
{noformat:title=console1}
[root@smf1-afh-07-sr4 ~]# perf stat -a -x, --log-fd 1 --pid 10940 --event cycles,task-clock
{noformat}

{noformat:title=console2}
kill -s SIGINT <pid_of_perf>
{noformat}

{noformat:title=console1}
[root@smf1-afh-07-sr4 ~]# perf stat -a -x, --log-fd 1 --pid 10940 --event cycles,task-clock
301291813,cycles
153.144374,task-clock

{noformat}

However, when I coded it, I wasn't able to read anything from stdout pipe after the perf subprocess was signaled and terminated. During the debugging, I did the following experiments. The following is not expected:

{noformat:title=console1}
[root@smf1-afh-07-sr4 ~]# perf stat -a -x, --output tmp --pid 10940 --event cycles,task-clock
{noformat}

{noformat:title=console2}
kill -s SIGINT <pid_of_perf>
{noformat}

{noformat:title=console1}
[root@smf1-afh-07-sr4 ~]# cat tmp
{noformat}

However, the following is expected:

{noformat:title=console1}
[root@smf1-afh-07-sr4 ~]# perf stat -a -x, --output tmp --pid 10940 --event cycles,task-clock -- sleep 1
[root@smf1-afh-07-sr4 ~]# cat tmp
# started on Thu Apr  2 22:40:09 2015

27932118,cycles
14.807048,task-clock
{noformat}

Anyone has any idea? Looks like shell's piping allows us to get the output correctly after receiving SIGINT while the file based redirection does not allow us to get the output correctly (This is also true for our subprocess stdout pipe).

> Let the slave control the duration of the perf sampler instead of relying on a sleep command.
> ---------------------------------------------------------------------------------------------
>
>                 Key: MESOS-2590
>                 URL: https://issues.apache.org/jira/browse/MESOS-2590
>             Project: Mesos
>          Issue Type: Improvement
>            Reporter: Jie Yu
>            Assignee: Jie Yu
>              Labels: twitter
>
> Right now, we use a sleep command to control the duration of perf sampling:
> {noformat}
> sudo perf stat -a -x, --log-fd 1 --pid 10940 -- sleep 10
> {noformat}
> This causes an additional process (i.e., the sleep process) to be forked and causes troubles for us to terminate the perf sampler once the slave exits (See MESOS-2462).
> Seems that the additional sleep process is not necessary. The slave can just monitor the duration and send a SIGINT to the perf process when duration elapsed. This will cause the perf process to output the stats and terminate.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)