SDL-Hercules-390 / hyperion

The SDL Hercules 4.x Hyperion version of the System/370, ESA/390, and z/Architecture Emulator
Other
240 stars 90 forks source link

Add LPAR name as prefix of thread names #577

Open swhobbit opened 1 year ago

swhobbit commented 1 year ago

When running multiple Hercules instances, if one shows threads on Linux one ends up with multiple names like "Processor CP00". It would be more useful to say "LPARNAME Processor CP00" or even "LPARNAME CP00"

Fish-Git commented 1 year ago

That sounds like a quite good and perfectly reasonable request! Thanks Drew! I'll get right on it as soon as I can!

swhobbit commented 1 year ago

That sounds like a quite good and perfectly reasonable request!

You are most kind. I thought it would easier than some. :-)

BTW, my example only showed CPU threads, but getting all reasonable threads would be great.

Fish-Git commented 1 year ago

One caveat though: I'm pretty sure on Windows that thread names are limited to 16 characters (or maybe 15; can't recall). I think Linux might impose a limit too, but am not sure about that, nor what the limit actually is if it does. Prefixing each thread's name with the LPARNAME could end up being a little tricky depending on how long your LPAR name is!

Fish-Git commented 1 year ago

It looks like *Nix imposes a maximum length of only 15 characters:

Fish-Git commented 1 year ago

Hercules code:

https://github.com/SDL-Hercules-390/hyperion/blob/65c97fd6c4dcecd9ad64b89e65432e1bda9f7515/hscutl.c#L1647-L1673

Fish-Git commented 1 year ago

LPARNAME is an 8 character field. So as I said, implementing this enhancement request may prove to be rather challenging (tricky).

Any ideas, Drew?  (Or anyone else?)

swhobbit commented 1 year ago

Take whole LPAR name if possible, space, seven characters for the thread data:

CPxx idlCCUU, CCUU (no idle), or IDLEcuu (which lops the high order nibble) TIMER

What other types do you have? Sometimes, you gotta think like a S/360 programmer lop stuff down to size.

We close with a reading from the tenth edition (May 1990) of the IBM Jargon dictionary, edited by IBM Fellow Mike Cowlishaw:

token n. An 8-character alphanumeric operand. This size was chosen because it just happened to fit the size of one of the System/360 atomic units of storage (the doubleword). Some operating systems and programs used to (and often still do) insist on parsing all input and truncating any words longer than 8 characters. [Especially annoying to those with 9-letter surnames.]

(Of course, Cowlishaw is nine characters.)

Fish-Git commented 1 year ago

What other types do you have?

https://github.com/SDL-Hercules-390/hyperion/blob/65c97fd6c4dcecd9ad64b89e65432e1bda9f7515/hthreads.h#L245-L275

swhobbit commented 1 year ago
#define BOOTSTRAP_NAME   "boot"
#define IMPL_NAME        "impl"
#define PANEL_NAME       "panel"
#define SOCKET_NAME      "sock"
#define LOGGER_NAME      "log"
#define SCRIPT_NAME      "scrpt"
#define TIMER_NAME       "timer"
#if defined( _FEATURE_073_TRANSACT_EXEC_FACILITY )
#define RUBATO_NAME      "rubato"
#endif
#define SCSISTAT_NAME    "scsist"
#define SCSIMOUNT_NAME   "scsimt"
#define CCKD_RA_NAME     "dra"
#define CCKD_WR_NAME     "dwtr"
#define CCKD_GC_NAME     "dol"
#define CON_CONN_NAME    "ttynew"
#define CONN_CLI_NAME    "ttycli"
#define HAO_NAME         "hao"
#define HTTP_SRVR_NAME   "websvr"
#define HTTP_REQ_NAME    "webreq"
#define WATCHDOG_NAME    "wdog"
#define HERCLIN_KB       "keybd"
swhobbit commented 1 year ago
SET_THREAD_NAME( exename );  

FYI: I would replace something like this with LPARNAME HERC.

Fish-Git commented 1 year ago

I'm also thinking this should probably be a new command-line option too, so the user can choose on a case-by-case basis whether they want thread names to be prefixed with some user-defined value or not.

That is to say, prefixing thread names with the LPARNAME, now that I think about it, might not be possible (or at least more difficult) to implement, given that the LPARNAME won't be known until the configuration files is processed (and, although I haven't checked, I believe some threads might get created before the LPARNAME has been processed and is known).

What do you think? New command-line option?

Fish-Git commented 1 year ago
#define BOOTSTRAP_NAME   "boot"
#define IMPL_NAME        "impl"
#define PANEL_NAME       "panel"
#define SOCKET_NAME      "sock"
...

I like it!  :)

swhobbit commented 1 year ago

What do you think? New command-line option?

If you want, but since on Linux by default top doesn't show threads in the first place (YMMV), it doesn't matter that much.

swhobbit commented 1 year ago

threads

Thread panel_display   tid=f7db9dc0 created on 16:11:03.901607 at hthreads.c:206  
Thread logger_thread   tid=f72a4440 created on 16:11:03.902303 at logger.c:584    
Thread watchdog_thread tid=f6efa440 created on 16:11:03.910833 at impl.c:1478     
Thread Processor CP00  tid=f69ff440 created on 16:11:03.912193 at config.c:1065   
Thread timer_thread    tid=f66ff440 created on 16:11:03.913430 at cpu.c:2345      
Thread http_server     tid=f6df9440 created on 16:11:03.941149 at httpserv.c:1044 
Thread socket_thread   tid=f6cbe440 created on 16:11:03.944343 at sockdev.c:533   
Thread console_connect tid=f57ff440 created on 16:11:03.947787 at console.c:718   
Thread CTCE 0E40 Liste tid=f4ef6440 created on 16:11:04.019277 at ctcadpt.c:2237  
Thread CTCE 0E40 Conne tid=f4df5440 created on 16:11:04.019992 at ctcadpt.c:3567  
Thread CTCE 0E41 Liste tid=f4cf4440 created on 16:11:04.020866 at ctcadpt.c:2237  
Thread CTCE 0E41 Conne tid=f4bf3440 created on 16:11:04.021605 at ctcadpt.c:3567  
Thread hao_thread      tid=f48f0440 created on 16:11:04.095450 at hao.c:93        
Thread CTCE 0E44 RecvT tid=f45ed440 created on 16:11:04.240214 at ctcadpt.c:2413  
Thread CTCE 0E45 RecvT tid=f44ec440 created on 16:11:04.240502 at ctcadpt.c:2413  
Thread cckd_ra         tid=f42ea440 created on 16:11:14.130132 at cckddasd.c:1594 
Thread dev 0E44 thrd   tid=f38ff440 created on 16:11:21.833460 at channel.c:2677  
Thread idle dev thrd   tid=f37fe440 created on 16:11:21.834877 at channel.c:2677  
Thread cckd_writer     tid=f46ee440 created on 16:14:02.161484 at cckddasd.c:1883 

Commenting on this partial display from a running system:

Fish-Git commented 1 year ago

If you want, but since on Linux top doesn't show threads in the first place (YMMV), it doesn't matter that much.

Eh?! What's this?! If top doesn't show threads, then what command does? What command are you using that prompted you (compelled you) to create this enhancement request in the first dang place?!

I'm confused!  :(

swhobbit commented 1 year ago

I bad. (Original comment corrected.)

If you want, but since on Linux top doesn't show threads in the first place (YMMV), it doesn't matter that much.

should read:

If you want, but since on Linux top by default doesn't show threads in the first place (YMMV), it doesn't matter that much.

Threads are enabled by capital H.

wrljet commented 1 year ago

Huh? in top?

swhobbit commented 1 year ago

Huh? in top?

More context please. What in top? Threads? Yes, capital H. Quoting the top manual age on Bullseye:

-H Threads-mode operation
Instructs top to display individual threads. Without this command-line option a summation of all threads in each process is shown. Later this can be changed with the H interactive command.

wrljet commented 1 year ago

I see no effect using -H command line option, or the H once Top is running.

Fish-Git commented 1 year ago
  • As noted previously, drop Processor, thread, and thrd.

Makes sense.

  • Change idle dev to dev idle so it matches dev 0E44

Also makes perfect sense.

  • Change cckd to dasd?

Nah. Dasd code and CCKD code are quite different things internally. As "dasd" and "cckd" are both 4 characters, I'm compelled to leave those as-is if you don't mind.

  • What's the ra in cckd_ra? (If it's "read", change ra to rd)

Again, no. The "ra" in the name stands for "read ahead":

 

swhobbit commented 1 year ago

I see no effect using -H command line option, or the H once Top is running.

Are you running threaded apps?

I specifically said I was using Bullseye (actually Raspberry PI OS B Bullseye); the top command was installed by apt. I even quoted the man page.

I also verified this on ubuntu 22.04.2 LTS (Jammy Jellyfish).

Hint: The second line of the top display changes from tasks to threads when you switch modes.

-ahd-

wrljet commented 1 year ago

I see no effect using -H command line option, or the H once Top is running.

Are you running threaded apps?

I don't know.

I specifically said I was using Bullseye (actually Raspberry PI OS B Bullseye); the top command was installed by apt. I even quoted the man page.

I also verified this on ubuntu 22.04.2 LTS (Jammy Jellyfish).

Hint: The second line of the top display changes from tasks to threads when you switch modes.

I did notice the change to "Threads". But nothing special was running at the time.

swhobbit commented 1 year ago

Change cckd to dasd?

Nah. Dasd code and CCKD code are quite different things internally. As "dasd" and "cckd" are both 4 characters, I'm compelled to leave those as-is if you don't mind.

What's the ra in cckd_ra? (If it's "read", change ra to rd)

Again, no. The "ra" in the name stands for "read ahead":

SGTM