Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Using Program Arguments with perf with Terminal Window
Forum Updated to NodeBB v4.3 + New Features

Using Program Arguments with perf with Terminal Window

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
7 Posts 3 Posters 590 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alex-sw30
    wrote on 16 May 2022, 14:33 last edited by
    #1

    I have a program which needs to start up in a terminal window and accept arguments at program entry (via the command line) and throughout the course of the program (think an interactive command line interface). I have my tools set up to accept the arguments, and it appears to not be acting on those arguments, additionally the program opens in the "Application Output" pane within Qt Creator rather than the terminal as specified in the "Projects" configuration.

    Any solutions to this would be greatly appreciated.

    J 1 Reply Last reply 16 May 2022, 14:56
    0
    • A Alex-sw30
      16 May 2022, 14:33

      I have a program which needs to start up in a terminal window and accept arguments at program entry (via the command line) and throughout the course of the program (think an interactive command line interface). I have my tools set up to accept the arguments, and it appears to not be acting on those arguments, additionally the program opens in the "Application Output" pane within Qt Creator rather than the terminal as specified in the "Projects" configuration.

      Any solutions to this would be greatly appreciated.

      J Offline
      J Offline
      JonB
      wrote on 16 May 2022, 14:56 last edited by JonB
      #2

      @Alex-sw30
      You should be able to access any command line arguments either via the argv passed into your main(argc, argv) or via Qt's own QCommandLineParser.

      throughout the course of the program (think an interactive command line interface).

      I don't know what that means. Command line arguments come from the command line, not interactively. They are quite different from a program which accepts input on its stdin and acts on it, like e.g. a shell. That is not what "command line arguments" means.

      additionally the program opens in the "Application Output" pane within Qt Creator rather than the terminal as specified in the "Projects" configuration.

      I don't know what that means either. Programs don't "open" in the "Application Output" pane. Creator shows their output there if it's a UI program (when stdout wouldn't go anywhere), but not if it's a console one.

      1 Reply Last reply
      2
      • A Offline
        A Offline
        Alex-sw30
        wrote on 16 May 2022, 15:03 last edited by
        #3

        Alright, let me clear these points up:

        The program is one which is intended to run solely in the terminal, or as a daemon.

        The program operates on two sets of user inputs: the program input arguments (passed via flags and interpreted at the start via argv) and a CLI which operates as a shell of sorts. I have the program selected to "Run in terminal" and with Command line arguments. When running perf, neither of these seem to be obeyed.

        The program output (stdout, stderr) is directed to the "Application Output" pane. Additionally, there is an input prompt for the user, > which is expected to appear if the Command line arguments are accepted. This does not appear in the Application Output pane, indicating to me that Qt is neither obeying the request for command line arguments or for running in a terminal.

        Programs don't "open" in the "Application Output" pane.

        Sorry, I said it this way to differentiate between the program running in terminal and appearing to be displayed in the "Application Output" pane.

        J R 2 Replies Last reply 16 May 2022, 15:30
        0
        • A Alex-sw30
          16 May 2022, 15:03

          Alright, let me clear these points up:

          The program is one which is intended to run solely in the terminal, or as a daemon.

          The program operates on two sets of user inputs: the program input arguments (passed via flags and interpreted at the start via argv) and a CLI which operates as a shell of sorts. I have the program selected to "Run in terminal" and with Command line arguments. When running perf, neither of these seem to be obeyed.

          The program output (stdout, stderr) is directed to the "Application Output" pane. Additionally, there is an input prompt for the user, > which is expected to appear if the Command line arguments are accepted. This does not appear in the Application Output pane, indicating to me that Qt is neither obeying the request for command line arguments or for running in a terminal.

          Programs don't "open" in the "Application Output" pane.

          Sorry, I said it this way to differentiate between the program running in terminal and appearing to be displayed in the "Application Output" pane.

          J Offline
          J Offline
          JonB
          wrote on 16 May 2022, 15:30 last edited by JonB
          #4

          @Alex-sw30 said in Using Program Arguments with perf with Terminal Window:

          When running perf, neither of these seem to be obeyed.

          Assuming you mean the Linux perf, I have no idea how that (with a console window) interacts with Qt Creator, or fails to do so. I think you are saying it works fine run directly from a console, but not under perf through Creator. You might try perf-ing it in a terminal, you don't have to do that from within Creator. As for perf itself, good luck if you can understand any of its output or that shown in Creator. I tried it --- having been familiar with profilers like gprof, and gave up after a day of trying to understand what it was trying to show me, which I found unintelligible! :)

          (And btw I have asked before in this forum about perf, got no answers, and discovered that the experts here do not profile their code. So I doubt you will get an answer about perf.)

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Alex-sw30
            wrote on 16 May 2022, 15:41 last edited by
            #5

            Thanks for your input.

            I find that the only truly helpful aspect of perf is the flame graph. I don't use it for profiling as much as understanding what is taking up the most amount of time in the code. If the code seems to run smoothly, great! But when things start to lag due to large amounts of calculations or unexpectedly repeated sections of code (think 100k+ line code base), I want to know where that lag comes from.

            J 1 Reply Last reply 16 May 2022, 15:45
            1
            • A Alex-sw30
              16 May 2022, 15:41

              Thanks for your input.

              I find that the only truly helpful aspect of perf is the flame graph. I don't use it for profiling as much as understanding what is taking up the most amount of time in the code. If the code seems to run smoothly, great! But when things start to lag due to large amounts of calculations or unexpectedly repeated sections of code (think 100k+ line code base), I want to know where that lag comes from.

              J Offline
              J Offline
              JonB
              wrote on 16 May 2022, 15:45 last edited by JonB
              #6

              @Alex-sw30
              I agree with your sentiments entirely. The problem is that I couldn't understand what perf's flame graph was showing me any more than any of its other output! :) Whereas I used to understand gprof fine.

              Anyway, as I said earlier: IF you are saying your code works fine outside of Qt Creator (or even from Creator) when you do not profile it, but then behaves oddly for I/O from/to console when you try to run from within Creator with profiling, I can only suggest you try perf directly from the terminal. I don't recall what/how, but perf must have displayable output quite separate from Qt/Creator. I do not think you will get an answer here as to what your console app with perf from Creator is not behaving right. Good luck though!

              1 Reply Last reply
              1
              • A Alex-sw30
                16 May 2022, 15:03

                Alright, let me clear these points up:

                The program is one which is intended to run solely in the terminal, or as a daemon.

                The program operates on two sets of user inputs: the program input arguments (passed via flags and interpreted at the start via argv) and a CLI which operates as a shell of sorts. I have the program selected to "Run in terminal" and with Command line arguments. When running perf, neither of these seem to be obeyed.

                The program output (stdout, stderr) is directed to the "Application Output" pane. Additionally, there is an input prompt for the user, > which is expected to appear if the Command line arguments are accepted. This does not appear in the Application Output pane, indicating to me that Qt is neither obeying the request for command line arguments or for running in a terminal.

                Programs don't "open" in the "Application Output" pane.

                Sorry, I said it this way to differentiate between the program running in terminal and appearing to be displayed in the "Application Output" pane.

                R Offline
                R Offline
                RokeJulianLockhart
                wrote 5 days ago last edited by
                #7

                @Alex-sw30, you might find strace useful for debugging this, since it should display the calls Qt Creator makes to invoke your application. Whether these differ with those options enabled or not might demonstrate something of use, although it's quite verbose.

                When using a forum, remember to tag the person you are responding to, in case they are not subscribed to the thread.

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved