list name thread of process in command line

Clovertech Forums Cloverleaf list name thread of process in command line

  • Creator
    Topic
  • #120516
    petitPadawan
    Participant

      I want to retrieve the list of full names of the threads of a process on the command line,
      I started with the hciconnstatus command,
      I have the list of threads but with the name truncated to 15 characters while some have 20 characters,
      this will allow me to do thread statistics with the hcmsiutil -dd command
      Do you have an idea

    Viewing 3 reply threads
    • Author
      Replies
      • #120517
        Tim Pancost
        Participant

          I suppose it depends on what version you’re on.  I don’t know when it was originally introduced, but on version 20.1, it’s just the -i argument on the hciconnstatus command.  That will give you column widths to hold the maximum process/thread names in that site.

          If you’re on a version before this was added, it depends on how deep you want to go down the rabbit hole.  For simplicity’s sake, we just took the the hciconnstatus command(it’s just a Tcl script), copied it from $HCIROOT/bin to $HCIROOT/usercmds(e.g. hciconnstat), and then modified the format statement that sets the column widths for the output:

          Before:

          set fmt “%-15.15s %-15.15s %-10.10s %-15.15s %-20.20s” ;# Output line format
          echo [format $fmt Process Connection State “Proto Status” When]
          echo “————— ————— ———- ————— ——————–”

          After:

          set fmt “%-20.20s %-20.20s %-10.10s %-15.15s %-20.20s” ;# Output line format
          echo [format $fmt Process Connection State “Proto Status” When]
          echo “——————– ——————– ———- ————— ——————–”

          Then, when you’re at command line, you just use hciconnstat(or whatever you called it) instead of hciconnstatus.

          HTH,

          TIM

          Tim Pancost
          Trinity Health

        • #120518
          Keith McLeod
          Participant

            For hciconnstatus to list the full name I would suggest back up the command file and update the following lines:

            set fmt “%-15.15s %-28.28s %-10.10s %-15.15s %-20.20s” ;# Output line format

            and you may want to adjust number of – characters in

            echo “————— —————————- ———- ————— ——————–”

            I would think of changing the the repeating characters to

            echo “[string repeat \- 15] [string repeat \- 28] [string repeat \- 10] [string repeat \- 15] [string repeat \- 20]”

            Or if in tcl, use ‘netconfig get process connections adt’, for example.  Here is more info on that tcl command.

            example: netconfig get process connections adt
            epic_adt2_out epic_adt3_out epic_adtv3_out epic_adt_in epic_adt1_out epic_adt4_out

            usage: netconfig action args

            action args:
            ———————————-
            get connection count
            get connection data <connection>
            get connection list
            get group connections <group>
            get group count
            get group list
            get process connections <process>
            get process count
            get process data <process>
            get process list
            get destination data <dest>
            get destination list
            get version
            ingroup <group> <connection>
            inprocess <process> <connection>
            load ?file?
            modified

          • #120519
            petitPadawan
            Participant

              that’s perfect, method 1 works great, thank you very much

            • #120520
              Keith McLeod
              Participant

                Got mired in the code.  Never thought of using that.  It is in 19.x.x.x.

                Usage:
                hciconnstatus [{-p process | -c connection}] [-s {P|T}] [-i] [-h]

                Where:
                default output is a summary of all processes and connections
                -p process = list all connections in <process>
                -c connection = list status of <connection>
                -s sort = P – sort by process, T – sort by Thread
                default – Sort by Process then by Thread
                -i = list intact process name and connection name without
                truncation
                -h = This usage screen

            Viewing 3 reply threads
            • You must be logged in to reply to this topic.