Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sessions for system_monitor #8660

Merged
merged 6 commits into from
Oct 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions erts/doc/references/erl_nif.md
Original file line number Diff line number Diff line change
Expand Up @@ -617,13 +617,8 @@ calling NIF API functions. Functions exist for the following functionality:
scheduler thread.

If the dirty NIF is expected to be CPU-bound, its `flags` field is to be set
to `ERL_NIF_DIRTY_JOB_CPU_BOUND` or `ERL_NIF_DIRTY_JOB_IO_BOUND`.

> #### Note {: .info }
>
> If one of the `ERL_NIF_DIRTY_JOB_*_BOUND` flags is set, and the runtime
> system has no support for dirty schedulers, the runtime system refuses to
> load the NIF library.
to `ERL_NIF_DIRTY_JOB_CPU_BOUND`. If it's expected to be I/O-bound set
`flags` to `ERL_NIF_DIRTY_JOB_IO_BOUND`.

- **`ErlNifBinary`**{: #ErlNifBinary }

Expand Down Expand Up @@ -3227,12 +3222,9 @@ long-running work into multiple regular NIF calls or to schedule a
If it cannot be converted to an atom, `enif_schedule_nif` returns a `badarg`
exception.

- **`flags`** - Must be set to `0` for a regular NIF. If the emulator was built
with dirty scheduler support enabled, `flags` can be set to either
- **`flags`** - Must be set to `0` for a regular NIF,
`ERL_NIF_DIRTY_JOB_CPU_BOUND` if the job is expected to be CPU-bound, or
`ERL_NIF_DIRTY_JOB_IO_BOUND` for jobs that will be I/O-bound. If dirty
scheduler threads are not available in the emulator, an attempt to schedule
such a job results in a `notsup` exception.
`ERL_NIF_DIRTY_JOB_IO_BOUND` for jobs that will be I/O-bound.

- **`argc` and `argv`** - Can either be the originals passed into the calling
NIF, or can be values created by the calling NIF.
Expand Down
2 changes: 0 additions & 2 deletions erts/emulator/beam/beam_bp.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@

#define ERTS_BPF_ALL 0x3FF

erts_atomic32_t erts_active_bp_index;
erts_atomic32_t erts_staging_bp_index;
erts_mtx_t erts_dirty_bp_ix_mtx;

ErtsTraceSession* erts_staging_trace_session;
Expand Down
7 changes: 0 additions & 7 deletions erts/emulator/beam/beam_bp.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ typedef struct GenericBpData {
BpDataCallTrace* memory; /* For memory trace */
} GenericBpData;

#define ERTS_NUM_BP_IX 2

typedef struct GenericBp {
BeamInstr orig_instr;
GenericBpData data[ERTS_NUM_BP_IX];
Expand All @@ -108,8 +106,6 @@ enum erts_break_op{
ERTS_BREAK_PAUSE
};

typedef Uint32 ErtsBpIndex;

typedef struct {
const ErtsCodeInfo *code_info;
Module* mod;
Expand Down Expand Up @@ -195,9 +191,6 @@ const ErtsCodeInfo *erts_find_local_func(const ErtsCodeMFA *mfa);

#if ERTS_GLB_INLINE_INCL_FUNC_DEF

extern erts_atomic32_t erts_active_bp_index;
extern erts_atomic32_t erts_staging_bp_index;

ERTS_GLB_INLINE ErtsBpIndex erts_active_bp_ix(void)
{
return erts_atomic32_read_nob(&erts_active_bp_index);
Expand Down
10 changes: 6 additions & 4 deletions erts/emulator/beam/bif.tab
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,6 @@ bif erlang:make_tuple/3

bif erlang:system_flag/2
bif erlang:system_info/1
# New in R9C
bif erlang:system_monitor/0
bif erlang:system_monitor/1
bif erlang:system_monitor/2
# Added 2006-11-07
bif erlang:system_profile/2
# End Added 2006-11-07
Expand Down Expand Up @@ -805,3 +801,9 @@ bif erts_internal:trace_pattern/4
bif erts_internal:trace_info/3
bif erts_trace_cleaner:check/0
bif erts_trace_cleaner:send_trace_clean_signal/1

#
# New in 28
#
bif erts_internal:system_monitor/1
bif erts_internal:system_monitor/3
9 changes: 5 additions & 4 deletions erts/emulator/beam/dist.c
Original file line number Diff line number Diff line change
Expand Up @@ -3610,8 +3610,8 @@ erts_dsig_send(ErtsDSigSendContext *ctx)
if (ctx->fragments) {
ctx->c_p->flags |= F_FRAGMENTED_SEND;
retval = ERTS_DSIG_SEND_CONTINUE;
if (!resume && erts_system_monitor_flags.busy_dist_port)
monitor_generic(ctx->c_p, am_busy_dist_port, cid);
if (!resume && erts_system_monitor_busy_dist_port_cnt)
monitor_busy_dist_port(ctx->c_p, cid);
goto done;
}
}
Expand All @@ -3635,8 +3635,9 @@ erts_dsig_send(ErtsDSigSendContext *ctx)
port_str, remote_str, pid_str);
}
#endif
if (!resume && erts_system_monitor_flags.busy_dist_port)
monitor_generic(ctx->c_p, am_busy_dist_port, cid);
if (!resume && erts_system_monitor_busy_dist_port_cnt) {
monitor_busy_dist_port(ctx->c_p, cid);
}
retval = ERTS_DSIG_SEND_YIELD;
} else {
retval = ERTS_DSIG_SEND_OK;
Expand Down
Loading
Loading