iipeace / guider

A Practically Applicable Performance Analyzer for Real Product Development
https://iipeace.github.io/docs/guider.html
GNU General Public License v2.0
629 stars 92 forks source link

Support the configuration of a shell environment before tracing a passed command #279

Open elfring opened 3 years ago

elfring commented 3 years ago

The tool “guider” supports tracing (or profiling) for passed commands. These commands are directly executed so far. But this execution configuration should be adjusted for some use cases.

We are used to functionality which is provided by some command-line interpreters. We would occasionally like to redirect data streams before a specified command will be executed. How should the corresponding shell be constructed (without extra tracing) so that the desired data processing will be continued as expected? :thinking:

iipeace commented 3 years ago

could you share more detailed examples? As I understand, You wanna control stdout stream for target task created by guider. isn't it?

elfring commented 3 years ago

I would like to specify special files for the standard data streams of my test programs so that the output will be separated from data by your analysis tool for further software test runs. I hope that I can avoid to construct additional shell scripts for data redirection purposes.

iipeace commented 3 years ago

Do you want to redirect stdout of specific program to specific file such a below example?

# guider btrace "ls -lha > ./output"
elfring commented 3 years ago

Yes (in principle)

Data redirections can be extended on demand, can't they?

iipeace commented 3 years ago

Yes, there was no option about it. I implemented new options about it and you can test them using such below examples.

# ./guider.py btrace "ls" -q stdout:"./stdout"
# ./guider.py btrace "ls" -q stderr:"./stderr"

They will affect standard I/O of all child tasks.

elfring commented 3 years ago

Yes, there was no option about it.

Thanks for another constructive feedback.

# ./guider.py btrace "ls" -q stdout:"./stdout"

I imagined an other solution approach. I hope that more data streams can be generally supported (like we are used to by the means of interactive shells).

iipeace commented 3 years ago

I hope that more data streams can be generally supported (like we are used to by the means of interactive shells).

How do you specify other data streams except for stdin, stdout, stderr? could you share more detailed examples? I can't understand ;)

elfring commented 3 years ago

How do you specify other data streams except for stdin, stdout, stderr?

Do you find the article “Linux Fundamentals – I/O, Standard Streams, and Redirection.” by Steven Vona helpful in this area?

I can't understand

Would you like to take another look in a manual from a popular shell?

iipeace commented 3 years ago

I got it. You wanna use pipe from stdout or stderr of target task to stdin of other process? Covering such all redirections is not small job ;)

How about making a new shell script for them?

elfring commented 3 years ago

Can a “shell” be chosen to resolve all configured redirections (similar to the way as it would usually happen in interactive mode)?

How about making a new shell script for them?

The evaluation of additional shell scripts might influence tracing approaches in undesirable ways, doesn't it?