From e17e236cd1661bc8f5bb1ebef0d80e93eb8f5b36 Mon Sep 17 00:00:00 2001
From: xsipewe By convention, most built-in functions (BIFs) are seen as being
- in the module By convention, most Built-In Functions (BIFs) are seen as being
+ in this module. Some of the BIFs are viewed more
or less as part of the Erlang programming language and are
- auto-imported. Thus, it is not necessary to specify
- the module name and both the calls In the text, auto-imported BIFs are listed without module prefix.
+ auto-imported. Thus, it is not necessary to specify the
+ module name. For example, the calls Auto-imported BIFs are listed without module prefix.
BIFs listed with module prefix are not auto-imported. BIFs may fail for a variety of reasons. All BIFs fail with
+ BIFs can fail for various reasons. All BIFs fail with
reason Some BIFs may be used in guard tests, these are marked with
+ incorrect type. The other reasons are described in the
+ description of each individual BIF. Some BIFs can be used in guard tests and are marked with
"Allowed in guard tests". A binary data object, structured according to
the Erlang external term format. See Returns an integer or float which is the arithmetical
- absolute value of Returns an integer or float that is the arithmetical
+ absolute value of Allowed in guard tests. Computes and returns the adler32 checksum for Computes and returns the adler32 checksum for
+ Continue computing the adler32 checksum by combining
- the previous checksum, The following code: - would assign the same value to Continues computing the adler32 checksum by combining
+ the previous checksum, The following code: assigns the same value to Combines two previously computed adler32 checksums.
- This computation requires the size of the data object for
- the second checksum to be known. The following code: - would assign the same value to Combines two previously computed adler32 checksums.
+ This computation requires the size of the data object for
+ the second checksum to be known. The following code: assigns the same value to Returns a new tuple which has one element more than
- Returns a new tuple that has one element more than
+ Example: Call a fun, passing the elements in Note: If the number of elements in the arguments are known at
- compile-time, the call is better written as
+ Calls a fun, passing the elements in If the number of elements in the arguments are known at
+ compile time, the call is better written as
Earlier,
> abs(-3.33).
3.33
@@ -153,206 +157,217 @@
- X = erlang:adler32(Data1),
- Y = erlang:adler32(X,Data2).
-
-
- Y = erlang:adler32([Data1,Data2]).
-
+
+ X = erlang:adler32(Data1),
+ Y = erlang:adler32(X,Data2).
+
+ Y = erlang:adler32([Data1,Data2]).
- Y = erlang:adler32(Data1),
- Z = erlang:adler32(Y,Data2).
-
-
- X = erlang:adler32(Data1),
- Y = erlang:adler32(Data2),
- Z = erlang:adler32_combine(X,Y,iolist_size(Data2)).
-
+
+ Y = erlang:adler32(Data1),
+ Z = erlang:adler32(Y,Data2).
+
+ X = erlang:adler32(Data1),
+ Y = erlang:adler32(Data2),
+ Z = erlang:adler32_combine(X,Y,iolist_size(Data2)).
> erlang:append_element({one, two}, three).
{one,two,three}
Returns the result of applying
Example:
> apply(lists, reverse, [[a, b, c]]). [c,b,a]-
> apply(erlang, atom_to_list, ['Erlang']). "Erlang"-
Note: If the number of arguments are known at compile-time, +
If the number of arguments are known at compile time,
the call is better written as
Failure:
Returns a binary which corresponds to the text
- representation of
Currently,
Returns a binary corresponding to the text
+ representation of
Example:
> atom_to_binary('Erlang', latin1).
<<"Erlang">>
Returns a string which corresponds to the text
- representation of
Returns a string corresponding to the text
+ representation of
> atom_to_list('Erlang').
"Erlang"
Extracts the part of the binary described by
Negative length can be used to extract bytes at the end of a binary:
- +Extracts the part of the binary described by
+
Negative length can be used to extract bytes at the end + of a binary, for example:
1> Bin = <<1,2,3,4,5,6,7,8,9,10>>.
2> binary_part(Bin,{byte_size(Bin), -5}).
-<<6,7,8,9,10>>
-
-
- If
Failure:
1> Bin = <<1,2,3>>
2> binary_part(Bin,{0,2}).
-<<1,2>>
-
-
- See the STDLIB module
For details about the
Allowed in guard tests.
The same as
The same as
Allowed in guard tests.
Returns the atom whose text representation is
-
Examples:
> binary_to_atom(<<"Erlang">>, latin1).
'Erlang'
@@ -362,20 +377,24 @@
called as binary_to_atom(<<208,128>>,utf8)
Works like
Failure:
As
+
Failure:
Returns the float whose text representation is
Returns the float whose text representation is
+
> binary_to_float(<<"2.2017764e+0">>). 2.2017764@@ -383,12 +402,13 @@ representation of a float.
Returns an integer whose text representation is
-
> binary_to_integer(<<"123">>). 123@@ -396,12 +416,13 @@ representation of an integer.
Returns an integer whose text representation in base
-
> binary_to_integer(<<"3FF">>, 16). 1023@@ -409,93 +430,101 @@ representation of an integer.
Returns a list of integers which correspond to the bytes of +
Returns a list of integers corresponding to the bytes of
As
This function's indexing style of using one-based indices for
- binaries is deprecated. New code should use the functions in
- the STDLIB module
The indexing style of using one-based indices for
+ binaries is deprecated for this function. New code is to
+ use the functions in module
Returns a list of integers which correspond to the bytes of
-
Returns a list of integers corresponding to the bytes of
+
Returns an Erlang term which is the result of decoding
- the binary object
Returns an Erlang term that is the result of decoding
+ binary object
When decoding binaries from untrusted sources, consider using
-
See also
-
When decoding binaries from untrusted sources,
+ consider using
See also
+
As
Use this option when receiving binaries from an untrusted +
Use this option when receiving binaries from an untrusted source.
-When enabled, it prevents decoding data that may be used to - attack the Erlang system. In the event of receiving unsafe - data, decoding fails with a badarg error.
-Currently, this prevents creation of new atoms directly, - creation of new atoms indirectly (as they are embedded in - certain structures like pids, refs, funs, etc.), and creation of - new external function references. None of those resources are - currently garbage collected, so unchecked creation of them can - exhaust available memory.
+When enabled, it prevents decoding data that can be used to
+ attack the Erlang system. In the event of receiving unsafe
+ data, decoding fails with a
This prevents creation of new atoms directly, + creation of new atoms indirectly (as they are embedded in + certain structures, such as process identifiers, + refs, and funs), and + creation of new external function references. + None of those resources are garbage collected, so unchecked + creation of them can exhaust available memory.
Failure:
Failure:
See also
Returns an integer which is the size in bits of
Returns an integer that is the size in bits of
+
> bit_size(<<433:16,3:3>>).
19
@@ -504,30 +533,34 @@
Allowed in guard tests.
This implementation-dependent function increments the reduction counter for the calling process. In the Beam emulator, the reduction counter is normally incremented by - one for each function and BIF call, and a context switch is - forced when the counter reaches the maximum number of reductions - for a process (2000 reductions in R12B).
+ one for each function and BIF call. A context switch is + forced when the counter reaches the maximum number of + reductions for a process (2000 reductions in OTP R12B).This BIF might be removed in a future version of the Beam +
This BIF can be removed in a future version of the Beam machine without prior warning. It is unlikely to be implemented in other Erlang implementations.
Returns an integer which is the number of bytes needed to contain
-
Returns an integer that is the number of bytes needed to
+ contain
Examples:
> byte_size(<<433:16,3:3>>).
3
@@ -536,12 +569,13 @@
Allowed in guard tests.
- Cancels a timer that has been created by either
+ Cancels a timer that has been created by
@@ -632,7 +666,7 @@
Cancels a timer. The same as calling
Returns
Returns
See also
The same as
-
Check if the node local process identified by
Currently available
Checks if the node local process identified by
The available
Determines if garbage collection is allowed when performing
+ the operation. If
The function
If
If
The process identified by
The process identified by
The operation was aborted, as the process needed to
+ be garbage collected to determine the operation result,
+ and the operation was requested
+ by passing option
See also
Failures:
Computes and returns the crc32 (IEEE 802.3 style) checksum for
Computes and returns the crc32 (IEEE 802.3 style) checksum
+ for
Continue computing the crc32 checksum by combining
- the previous checksum,
The following code:
-
- X = erlang:crc32(Data1),
- Y = erlang:crc32(X,Data2).
-
- - would assign the same value to
- Y = erlang:crc32([Data1,Data2]).
-
+ Continues computing the crc32 checksum by combining
+ the previous checksum,
The following code:
+
+ X = erlang:crc32(Data1),
+ Y = erlang:crc32(X,Data2).
+ assigns the same value to
+ Y = erlang:crc32([Data1,Data2]).
Combines two previously computed crc32 checksums. - This computation requires the size of the data object for - the second checksum to be known.
-The following code:
-
- Y = erlang:crc32(Data1),
- Z = erlang:crc32(Y,Data2).
-
- - would assign the same value to
Combines two previously computed crc32 checksums. + This computation requires the size of the data object for + the second checksum to be known.
+The following code:
+
+ Y = erlang:crc32(Data1),
+ Z = erlang:crc32(Y,Data2).
+ assigns the same value to
- X = erlang:crc32(Data1),
- Y = erlang:crc32(Data2),
- Z = erlang:crc32_combine(X,Y,iolist_size(Data2)).
-
+ X = erlang:crc32(Data1),
+ Y = erlang:crc32(Data2),
+ Z = erlang:crc32_combine(X,Y,iolist_size(Data2)).
Returns the current date as
The time zone and daylight saving time correction depend on +
The time zone and Daylight Saving Time correction depend on the underlying OS.
+Example:
> date().
{1995,2,19}
Decodes the binary
If an entire packet is contained in
If an entire packet is contained in
If
If the packet does not conform to the protocol format +
If the packet does not conform to the protocol format,
The following values of
The following
No packet handling is done. Entire binary is +
No packet handling is done. The entire binary is returned unless it is empty.
Packets consist of a header specifying the number of bytes in the packet, followed by that number of bytes. - The length of header can be one, two, or four bytes; + The length of the header can be one, two, or four bytes; the order of the bytes is big-endian. The header - will be stripped off when the packet is returned.
+ is stripped off when the packet is returned.A packet is a line terminated with newline. The +
A packet is a line-terminated with newline. The
newline character is included in the returned packet
- unless the line was truncated according to the option
+ unless the line was truncated according to option
The Hypertext Transfer Protocol. The packets
are returned with the format according to
-
Recognized request methods and header fields are returned as atoms.
- Others are returned as strings. Strings of unrecognized header fields
- are formatted with only capital letters first and after hyphen characters
- (like
The protocol type
Recognized request methods and header fields are returned
+ as atoms. Others are returned as strings. Strings of
+ unrecognized header fields are formatted with only
+ capital letters first and after hyphen characters, for
+ example,
The protocol type
The variants
The variants
The following options are available:
Sets the max allowed size of the packet body. If - the packet header indicates that the length of the - packet is longer than the max allowed length, the packet - is considered invalid. Default is 0 which means no - size limit.
+Sets the maximum allowed size of the packet body. + If the packet header indicates that the length of the + packet is longer than the maximum allowed length, the + packet is considered invalid. Default is 0, which means + no size limit.
For packet type
Option
For packet type
Option
Examples:
> erlang:decode_packet(1,<<3,"abcd">>,[]).
{ok,<<"abc">>,<<"d">>}
@@ -909,13 +949,11 @@
- Delete element at index in a tuple
+ Deletes element at index in a tuple.
1..tuple_size(Tuple1 )
-
- Returns a new tuple with element at Index removed from
- tuple Tuple1 .
-
+ Returns a new tuple with element at Index
+ removed from tuple Tuple1 , for example:
> erlang:delete_element(2, {one, two, three}).
{one,three}
@@ -924,78 +962,82 @@
- Make the current code for a module old
+ Makes the current code for a module old.
- Makes the current code for Module become old code, and
- deletes all references for this module from the export table.
+
Makes the current code for Module become old code,
+ and deletes all references for this module from the export table.
Returns undefined if the module does not exist,
otherwise true .
This BIF is intended for the code server (see
- code(3) ) and should not be
- used elsewhere.
+ code(3) ) and is not
+ to be used elsewhere.
- Failure: badarg if there is already an old version of
+
Failure: badarg if there already is an old version of
Module .
+
- Stop monitoring
+ Stops monitoring.
- If MonitorRef is a reference which the calling process
- obtained by calling
+
If MonitorRef is a reference that the
+ calling process obtained by calling
monitor/2 ,
this monitoring is turned off. If the monitoring is already
turned off, nothing happens.
- Once demonitor(MonitorRef ) has returned it is
- guaranteed that no {'DOWN', MonitorRef , _, _, _} message
- due to the monitor will be placed in the caller's message queue
- in the future. A {'DOWN', MonitorRef , _, _, _} message
- might have been placed in the caller's message queue prior to
- the call, though. Therefore, in most cases, it is advisable
+
Once demonitor(MonitorRef ) has returned, it is
+ guaranteed that no {'DOWN',
+ MonitorRef , _, _, _} message,
+ because of the monitor, will be placed in the caller message queue
+ in the future. A {'DOWN',
+ MonitorRef , _, _, _} message
+ can have been placed in the caller message queue before
+ the call, though. It is therefore usually advisable
to remove such a 'DOWN' message from the message queue
- after monitoring has been stopped.
- demonitor(MonitorRef , [flush]) can be used instead of
+ after monitoring has been stopped.
+ demonitor(MonitorRef , [flush])
+ can be used instead of
demonitor(MonitorRef ) if this cleanup is wanted.
- Prior to OTP release R11B (erts version 5.5) demonitor/1
- behaved completely asynchronous, i.e., the monitor was active
- until the "demonitor signal" reached the monitored entity. This
- had one undesirable effect, though. You could never know when
- you were guaranteed not to receive a DOWN message
- due to the monitor.
- Current behavior can be viewed as two combined operations:
- asynchronously send a "demonitor signal" to the monitored entity
- and ignore any future results of the monitor.
+ Before OTP R11B (ERTS 5.5), demonitor/1
+ behaved asynchronous, that is, the monitor was active
+ until the "demonitor signal" reached the monitored entity.
+ This had an undesirable effect, as you could never know when
+ you were guaranteed not to receive a DOWN
+ message because of the monitor.
+ The current behavior can be viewed as two combined operations:
+ asynchronously send a "demonitor signal" to the monitored
+ entity and ignore any future results of the monitor.
Failure: It is an error if MonitorRef refers to a
monitoring started by another process. Not all such cases are
- cheap to check; if checking is cheap, the call fails with
- badarg (for example if MonitorRef is a remote
- reference).
+ cheap to check. If checking is cheap, the call fails with
+ badarg for example, if MonitorRef is a
+ remote reference.
+
- Stop monitoring
+ Stops monitoring.
The returned value is true unless info is part
- of OptionList .
-
+ of OptionList .
demonitor(MonitorRef , []) is equivalent to
demonitor(MonitorRef ) .
- Currently the following Option s are valid:
+ The available Option s are as follows:
flush
-
-
Remove (one) {_, MonitorRef , _, _, _} message,
- if there is one, from the caller's message queue after
+
Removes (one) {_,
+ MonitorRef , _, _, _} message,
+ if there is one, from the caller message queue after
monitoring has been stopped.
Calling demonitor(MonitorRef , [flush])
is equivalent to the following, but more efficient:
-
demonitor(MonitorRef),
receive
{_, MonitorRef, _, _, _} ->
@@ -1006,78 +1048,90 @@
info
-
-
The returned value is one of the following:
-
- true
- The monitor was found and removed. In this case
- no 'DOWN' message due to this monitor have
- been nor will be placed in the message queue
- of the caller.
-
-
- false
- The monitor was not found and could not be removed.
- This probably because someone already has placed a
- 'DOWN' message corresponding to this monitor
- in the caller's message queue.
-
-
-
- If the info option is combined with the flush
- option, false will be returned if a flush was needed;
- otherwise, true .
-
+ The returned value is one of the following:
+
+ true
+ - The monitor was found and removed. In this case,
+ no
'DOWN' message corresponding to this
+ monitor has been delivered and will not be delivered.
+
+ false
+ - The monitor was not found and could not be removed.
+ This probably because someone already has placed a
+
'DOWN' message corresponding to this monitor
+ in the caller message queue.
+
+
+ If option info is combined with option flush ,
+ false is returned if a flush was needed,
+ otherwise true .
- More options may be added in the future.
+ More options can be added in a future release.
- Failure: badarg if OptionList is not a list, or
- if Option is not a valid option, or the same failure as for
- demonitor/1
+ Failures:
+
+ badarg
+ - If
OptionList is not a list.
+
+ badarg
+ - If
Option is an invalid option.
+
+ badarg
+ - The same failure as for
+
demonitor/1 .
+
+
+
- Force the disconnection of a node
+ Forces the disconnection of a node.
- Forces the disconnection of a node. This will appear to
- the node Node as if the local node has crashed. This
- BIF is mainly used in the Erlang network authentication
- protocols. Returns true if disconnection succeeds,
+
Forces the disconnection of a node. This appears to
+ the node Node as if the local node has crashed.
+ This BIF is mainly used in the Erlang network authentication
+ protocols.
+ Returns true if disconnection succeeds,
otherwise false . If the local node is not alive,
- the function returns ignored .
+ ignored is returned.
+
- Print a term on standard output
+ Prints a term on standard output.
- Prints a text representation of Term on the standard
- output. On OSE the term is printed to the ramlog.
+ Prints a text representation of Term on the
+ standard output. On OSE, the term is printed to the ramlog.
This BIF is intended for debugging only.
+
1..tuple_size(Tuple )
- Get Nth element of a tuple
+ Returns the Nth element of a tuple.
Returns the N th element (numbering from 1) of
- Tuple .
+ Tuple , for example:
> element(2, {a, b, c}).
b
Allowed in guard tests.
+
- Return and delete the process dictionary
+ Returns and deletes the process dictionary.
- Returns the process dictionary and deletes it.
+ Returns the process dictionary and deletes it, for
+ example:
> put(key1, {1, 2, 3}),
put(key2, [a, b, c]),
@@ -1085,13 +1139,16 @@ b
[{key1,{1,2,3}},{key2,[a,b,c]}]
Returns the value
Returns the value
Example:
> put(key1, {merry, lambs, are, playing}),
X = erase(key1),
@@ -1099,16 +1156,19 @@ b
{{merry,lambs,are,playing},undefined}
Stops the execution of the calling process with the reason
-
Example:
> catch error(foobar).
{'EXIT',{foobar,[{erl_eval,do_apply,5},
@@ -1118,29 +1178,34 @@ b
{shell,eval_loop,3}]}}
Stops the execution of the calling process with the reason
-
Stops the execution of the calling process with the exit
- reason
Stops the execution of the calling process with exit reason
+
Example:
> exit(foobar). ** exception exit: foobar @@ -1148,110 +1213,117 @@ b{'EXIT',foobar}
Sends an exit signal with exit reason
The following behavior apply if
If
If
If
The following behavior applies if
If
If
Calculates, without doing the encoding, the maximum byte size for a term encoded in the Erlang external term format. The following condition applies always:
-
> Size1 = byte_size(term_to_binary(- -Term )), > Size2 = erlang:external_size(Term ), > true = Size1 =< Size2. -true -
This is equivalent to a call to: erlang:external_size(
This is equivalent to a call to:
+erlang:external_size(Term , [])
Calculates, without doing the encoding, the maximum byte size for a term encoded in the Erlang external term format. The following condition applies always:
-
> Size1 = byte_size(term_to_binary(- -Term ,Options )), > Size2 = erlang:external_size(Term ,Options ), > true = Size1 =< Size2. -true -
The option
Option
Returns a float by converting
Returns a float by converting
> float(55). 55.0
Allowed in guard tests.
Note that if used on the top-level in a guard, it will - test whether the argument is a floating point number; for - clarity, use +
If used on the top level in a guard, it tests whether the
+ argument is a floating point number; for clarity, use
When
The same as
The same as
+
Returns a binary which corresponds to the text +
Returns a binary corresponding to the text
representation of
Examples:
> float_to_binary(7.12, [{decimals, 4}]).
<<"7.1200">>
@@ -1259,31 +1331,42 @@ true
<<"7.12">>
The same as
The same as
+
Returns a string which corresponds to the text
- representation of
Returns a string corresponding to the text representation
+ of
Examples:
> float_to_list(7.12, [{decimals, 4}]).
"7.1200"
@@ -1291,36 +1374,40 @@ true
"7.12"
Returns a list containing information about the fun
-
Returns a list with information about the fun
+
This BIF is mainly intended for debugging, but it can - occasionally be useful in library functions that might need - to verify, for instance, the arity of a fun.
+ sometimes be useful in library functions that need + to verify, for example, the arity of a fun.There are two types of funs with slightly different - semantics:
-A fun created by
All other funs are called local. When a local fun - is called, the same version of the code that created the fun - will be called (even if newer version of the module has been - loaded).
-The following elements will always be present in the list +
Two types of funs have slightly different semantics:
+The following elements are always present in the list for both local and external funs:
If
If
The following elements will only be present in the list if +
The following elements are only present in the list if
Returns information about
For any fun,
For a local fun,
For a local fun,
See
Returns a string which corresponds to the text +
Returns a string corresponding to the text
representation of
Returns
This function used to return false for built-in functions before the 18.0 release.
Forces an immediate garbage collection of the currently - executing process. The function should not be used, unless - it has been noticed -- or there are good reasons to suspect -- +
Forces an immediate garbage collection of the + executing process. The function is not to be used unless + it has been noticed (or there are good reasons to suspect) that the spontaneous garbage collection will occur too late - or not at all. Improper use may seriously degrade system - performance.
+ or not at all. +Improper use can seriously degrade system performance.
+The same as
Garbage collect the node local process identified by
-
Currently available
Garbage collects the node local process identified by
+
The available
If
Note that the same caveats as for
-
Notice that the same caveats apply as for
+
Failures:
Returns the process dictionary as a list of
-
> put(key1, merry),
put(key2, lambs),
@@ -1520,13 +1613,15 @@ true
[{key1,merry},{key2,lambs},{key3,{are,playing}}]
Returns the value
Example:
> put(key1, merry),
put(key2, lambs),
@@ -1535,14 +1630,16 @@ true
{are,playing}
Returns the magic cookie of the local node, if the node is
- alive; otherwise the atom
Returns the magic cookie of the local node if the node is
+ alive, otherwise the atom
Returns a list of keys which are associated with the value
-
Returns a list of keys that are associated with the value
+
> put(mary, {1, 2}),
put(had, {1, 2}),
@@ -1573,40 +1670,40 @@ true
[mary,had,a,little,lamb]
Get the call stack back-trace (stacktrace) of the last - exception in the calling process as a list of +
Gets the call stack back-trace (stacktrace) of the
+ last exception in the calling process as a list of
If there has not been any exceptions in a process, the
stacktrace is
The stacktrace is the same data as the
The second element of the tuple is a string (list of
+
The second element of the tuple is the line number
+
See also
@@ -1614,49 +1711,56 @@ true
Returns the pid of the group leader for the process which - evaluates the function.
+Returns the process identifier of the group leader for the + process evaluating the function.
Every process is a member of some process group and all
- groups have a group leader. All IO from the group
+ groups have a group leader. All I/O from the group
is channeled to the group leader. When a new process is
spawned, it gets the same group leader as the spawning
- process. Initially, at system start-up,
Sets the group leader of
Sets the group leader of
See also
The same as
Example:
> halt(). os_prompt%
The same as
Example:
> halt(17). os_prompt% echo $? @@ -1664,178 +1768,188 @@ os_prompt% echo $? os_prompt%
Note that on many platforms, only the status codes 0-255 are - supported by the operating system. -
-For integer
For statuses
On many platforms, the OS supports only status + codes 0-255.
For integer
For statuses
Returns a hash value for
This BIF is deprecated as the hash value may differ on - different architectures. Also the hash values for integer - terms larger than 2^27 as well as large binaries are very +
This BIF is deprecated, as the hash value can differ on
+ different architectures. The hash values for integer
+ terms higher than 2^27 and large binaries are
poor. The BIF is retained for backward compatibility
- reasons (it may have been used to hash records into a file),
- but all new code should use one of the BIFs
+ reasons (it can have been used to hash records into a file),
+ but all new code is to use one of the BIFs
Returns the head of
Returns the head of
> hd([1,2,3,4,5]). 1
Allowed in guard tests.
-Failure:
Failure:
Puts the calling process into a wait state where its memory - allocation has been reduced as much as possible, which is + allocation has been reduced as much as possible. This is useful if the process does not expect to receive any messages - in the near future.
-The process will be awaken when a message is sent to it, and
- control will resume in
The process is awaken when a message is sent to it, and control
+ resumes in
If the process has any message in its message queue, - the process will be awaken immediately in the same way as - described above.
+ the process is awakened immediately in the same way as + described earlier.In more technical terms, what
If the size of the live data in the process is less than the minimum heap size, the first garbage collection occurring - after the process has been awaken will ensure that the heap + after the process is awakened ensures that the heap size is changed to a size not smaller than the minimum heap size.
-Note that emptying the call stack means that any surrounding
-
Notice that emptying the call stack means that any surrounding
+
- Returns a new tuple with element
Returns a new tuple with element
Example:
> erlang:insert_element(2, {one, two, three}, new).
{one,new,two,three}
Returns a binary which corresponds to the text
- representation of
Returns a binary corresponding to the text
+ representation of
> integer_to_binary(77). <<"77">>
Returns a binary which corresponds to the text
- representation of
Returns a binary corresponding to the text
+ representation of
> integer_to_binary(1023, 16). <<"3FF">>
Returns a string which corresponds to the text
- representation of
Returns a string corresponding to the text
+ representation of
> integer_to_list(77). "77"
Returns a string which corresponds to the text
- representation of
Returns a string corresponding to the text
+ representation of
> integer_to_list(1023, 16). "3FF"
Returns a binary which is made from the integers and
- binaries in
Returns a binary that is made from the integers and
+ binaries in
> Bin1 = <<1,2,3>>. <<1,2,3>> @@ -1847,278 +1961,311 @@ os_prompt%<<1,2,3,1,2,3,4,5,4,6>>
Returns an integer which is the size in bytes
- of the binary that would be the result of
-
Returns an integer that is the size in bytes
+ of the binary that would be the result of
+
> iolist_size([1,2|<<3,4>>]). 4
Returns
Returns
Returns
Returns
Allowed in guard tests.
Returns
Returns
A binary always contains a complete number of bytes.
-Allowed in guard tests.
Returns
Returns
Allowed in guard tests.
Returns
Returns
Allowed in guard tests.
Returns
This BIF is useful for builders of cross-reference tools.
+Returns
Returns
Allowed in guard tests.
Returns
Returns
Allowed in guard tests.
Returns
Allowed in guard tests.
Returns
Returns
Allowed in guard tests.
Returns
Allowed in guard tests.
Returns
Returns
Allowed in guard tests.
Returns
Returns
Allowed in guard tests.
Returns
Returns
Allowed in guard tests.
Returns
Returns
Allowed in guard tests.
-
Returns
Returns
Returns
Normally the compiler treats calls to
Allowed in guard tests, if
Allowed in guard tests, if
Allowed in guard tests, provided that Returns Allowed in guard tests if This BIF is documented for completeness. In most cases
- This BIF is documented for completeness. Usually
+
Returns
Returns
Allowed in guard tests.
Returns
Returns
Allowed in guard tests.
Returns the length of
Returns the length of
> length([1,2,3,4,5,6,7,8,9]). 9
Allowed in guard tests.
Creates a link between the calling process and another
- process (or port)
If
If
Returns the atom whose text representation is
Returns the atom whose text representation is
+
Example:
> list_to_atom("Erlang").
'Erlang'
Returns a binary which is made from the integers and
- binaries in
Returns a binary that is made from the integers and
+ binaries in
> Bin1 = <<1,2,3>>. <<1,2,3>> @@ -2130,14 +2277,16 @@ os_prompt%<<1,2,3,1,2,3,4,5,4,6>>
Returns a bitstring which is made from the integers and
- bitstrings in
Returns a bitstring that is made from the integers and
+ bitstrings in
Example:
> Bin1 = <<1,2,3>>. <<1,2,3>> @@ -2149,21 +2298,25 @@ os_prompt%<<1,2,3,1,2,3,4,5,4,6,7:46>>
Returns the atom whose text representation is
Returns the atom whose text representation is
+
Failure:
Returns the float whose text representation is
Returns the float whose text representation is
+
> list_to_float("2.2017764e+0").
2.2017764
@@ -2171,12 +2324,13 @@ os_prompt%
representation of a float.
Returns an integer whose text representation is
-
> list_to_integer("123").
123
@@ -2184,12 +2338,14 @@ os_prompt%
representation of an integer.
Returns an integer whose text representation in base
-
> list_to_integer("3FF", 16).
1023
@@ -2197,47 +2353,52 @@ os_prompt%
representation of an integer.
Returns a pid whose text representation is
This BIF is intended for debugging and for use in - the Erlang operating system. It should not be used in - application programs.
-Returns a process identifier whose text representation is a
+
> list_to_pid("<0.4.1>").
<0.4.1>
Failure:
This BIF is intended for debugging and for use in the + Erlang OS. It is not to be used in application programs.
+Returns a tuple which corresponds to
Returns a tuple corresponding to
> list_to_tuple([share, ['Ericsson_B', 163]]).
{share, ['Ericsson_B', 163]}
+ If
If
Returns either
This BIF is intended for the code server (see
-
In releases older than OTP R14B, NIFs were an - experimental feature. Versions of OTP older than R14B might +
Before OTP R14B, NIFs were an
+ experimental feature. Versions before OTP R14B can
have different and possibly incompatible NIF semantics and
- interfaces. For example, in R13B03 the return value on
- failure was
-
Loads and links a dynamic library containing native
- implemented functions (NIFs) for a module.
The call to
It returns either
The OS failed to load the NIF library.
+The library did not fulfil the requirements as a NIF - library of the calling module.
+The corresponding library callback was not successful.
+The call to
Returns a list of all loaded Erlang modules (current and/or +
Returns a list of all loaded Erlang modules (current and old code), including preloaded modules.
See also
Returns the current local date and time
-
The time zone and daylight saving time correction depend - on the underlying OS.
+Returns the current local date and time,
+
> erlang:localtime().
{{1996,11,6},{14,45,17}}
+ The time zone and Daylight Saving Time correction depend + on the underlying OS.
Converts local date and time to Universal Time Coordinated
- (UTC), if this is supported by the underlying OS. Otherwise,
- no conversion is done and
Example:
> erlang:localtime_to_universaltime({{1996,11,6},{14,45,17}}).
{{1996,11,6},{13,45,17}}
- Failure:
Failure:
Converts local date and time to Universal Time Coordinated
- (UTC) just like
If
If
Examples:
> erlang:localtime_to_universaltime({{1996,11,6},{14,45,17}}, true).
{{1996,11,6},{12,45,17}}
@@ -2366,13 +2531,14 @@ os_prompt%
{{1996,11,6},{13,45,17}}
> erlang:localtime_to_universaltime({{1996,11,6},{14,45,17}}, undefined).
{{1996,11,6},{13,45,17}}
- Failure:
Failure:
Return a
Returns a new tuple of the given
Creates a new tuple of the given
> erlang:make_tuple(4, []).
{[],[],[],[]}
Creates a tuple of size
Example:
> erlang:make_tuple(5, [], [{2,ignored},{5,zz},{2,aa}]).
{{[],aa,[],[],zz}
Returns an integer which is the number of key-value pairs in
Returns an integer, which is the number of key-value pairs
+ in
> map_size(#{a=>1, b=>2, c=>3}).
3
Allowed in guard tests.
Return the largest of
Returns the largest of
Computes an
Computes an MD5 message digest from
See The MD5 Message Digest Algorithm (RFC 1321) for more - information about MD5.
-The MD5 Message Digest Algorithm is not considered - safe for code-signing or software integrity purposes.
For more information about MD5, see RFC 1321 - The + MD5 Message-Digest Algorithm.
+The MD5 Message-Digest Algorithm is not considered + safe for code-signing or software-integrity purposes.
Finishes the update of an MD5
Creates an MD5 context, to be used in subsequent calls to
Updates an MD5
Updates an MD5
Returns a list containing information about memory
- dynamically allocated by the Erlang emulator. Each element of
- the list is a tuple
Returns a list with information about memory
+ dynamically allocated by the Erlang emulator. Each list
+ element is a tuple
The memory types are as follows:
The total amount of memory currently allocated, which is
- the same as the sum of memory size for
The total amount of memory currently allocated. This is
+ the same as the sum of the memory size for
The total amount of memory currently allocated by +
The total amount of memory currently allocated for the Erlang processes.
The total amount of memory currently used by the Erlang - processes.
-This memory is part of the memory presented as
+ processes. This is part of the memory presented as
The total amount of memory currently allocated by +
The total amount of memory currently allocated for the emulator that is not directly related to any Erlang - process.
-Memory presented as
The total amount of memory currently allocated for atoms.
-This memory is part of the memory presented as +
The total amount of memory currently allocated for atoms.
+ This memory is part of the memory presented as
The total amount of memory currently used for atoms.
-This memory is part of the memory presented as +
The total amount of memory currently used for atoms.
+ This memory is part of the memory presented as
The total amount of memory currently allocated for - binaries.
-This memory is part of the memory presented as
-
The total amount of memory currently allocated for - Erlang code.
-This memory is part of the memory presented as
-
The total amount of memory currently allocated for ets - tables.
-This memory is part of the memory presented as
+ tables. This memory is part of the memory presented as
Only on 64-bit halfword emulator.
-The total amount of memory allocated in low memory areas - that are restricted to less than 4 Gb even though - the system may have more physical memory.
-May be removed in future releases of halfword emulator.
+Only on 64-bit halfword emulator. + The total amount of memory allocated in low memory areas + that are restricted to less than 4 GB, although + the system can have more memory.
+Can be removed in a future release of the halfword + emulator.
The maximum total amount of memory allocated since - the emulator was started.
-This tuple is only present when the emulator is run with - instrumentation.
+ the emulator was started. This tuple is only present + when the emulator is run with instrumentation.For information on how to run the emulator with
- instrumentation see
+ instrumentation, see
The
When the emulator is run with instrumentation,
the
Since the
As the
The different amounts of memory that are summed are - not gathered atomically which also introduce + not gathered atomically, which introduces an error in the result.
The different values has the following relation to each +
The different values have the following relation to each other. Values beginning with an uppercase letter is not part of the result.
@@ -2584,69 +2759,62 @@ os_prompt%
processes = processes_used + ProcessesNotUsed
system = atom + binary + code + ets + OtherSystem
atom = atom_used + AtomNotUsed
-
RealTotal = processes + RealSystem
RealSystem = system + MissedSystem
- More tuples in the returned list may be added in the future.
+More tuples in the returned list can be added in a + future release.
The
Furthermore, because of fragmentation and prereservation of + memory areas, the size of the memory segments containing + the dynamically allocated memory blocks can be much larger than the total size of the dynamically allocated memory blocks.
- Since erts version 5.6.4
As from
Failure:
-Failure:
Returns the memory size in bytes allocated for memory of
type
- Since erts version 5.6.4
As from
Failures:
Return the smallest of
Returns the smallest of
Returns
Returns
This BIF is intended for the code server (see
-
Send a monitor request of type The monitor request is an asynchronous signal. That is, it
takes time before the signal reach its destination.{Tag,
Currently valid
Valid
Monitor the existence of the process identified by
-
When a process is monitored by registered name, the
- process that has the registered name at the time when the
+ When a registered name is used, the
+ process that has the registered name when the
monitor request reach its destination will be monitored.
- The monitor will not be effected, if the registered name is
+ The monitor is not effected if the registered name is
unregistered, or unregistered and later registered on another
process.
The monitor is triggered either when the monitored process @@ -2732,22 +2904,22 @@ os_prompt% lost. In the case the connection to it is lost, we do not know if it still exist or not. After this type of monitor has been triggered, the monitor is automatically removed.
-When the monitor is triggered a
When the monitor is triggered a
{'DOWN', MonitorRef, Type, Object, Info}
- where
Here
equals:
The monitoring is turned off either when the
The monitoring is turned off when the
If an attempt is made to monitor a process on an older node
- (where remote process monitoring is not implemented or one
+ (where remote process monitoring is not implemented or
where remote process monitoring by registered name is not
implemented), the call fails with
The format of the
The format of the
When the
Making several calls to
The monitor functionality is expected to be extended. That is,
other
If/when
If or when
Monitors the status of the node
Monitors the status of the node
Making several calls to
If
Nodes connected through hidden connections can be monitored - as any other node.
+ as any other nodes.Failure:
Behaves as
Behaves as
+
The
Option
Failure:
Works exactly like
-
Works exactly like
-
Returns the name of the local node. If the node is not alive,
Allowed in guard tests.
Returns the node where
Returns the node where
Allowed in guard tests.
Returns a list of all visible nodes in the system, excluding +
Returns a list of all visible nodes in the system, except
the local node. Same as
Returns a list of nodes according to argument given. - The result returned when the argument is a list, is the list +
Returns a list of nodes according to the argument given. + The returned result when the argument is a list, is the list of nodes satisfying the disjunction(s) of the list elements.
Nodes which are known to this node, i.e., connected, - previously connected, etc.
+Nodes that are known to this node, for example, connected + and previously connected.
Some equalities:
If the local node is not alive,
-
This function is deprecated! Do not use it!
See the users guide chapter
@@ -3050,107 +3235,101 @@ os_prompt%
section for information on what to use instead of
Returns the tuple
It can only be used to check the local time of day if - the time-zone info of the underlying operating system is +
Can only be used to check the local time of day if + the time-zone information of the underlying OS is properly configured.
Returns a port identifier as the result of opening a new Erlang port. A port can be seen as an external Erlang - process. -
+ process.The name of the executable as well as the arguments
- given in
The characters in the name (if given as a list)
- can only be > 255 if the Erlang VM is started in
- Unicode file name translation mode, otherwise the name
+ encoding. For details, see the module
+
The characters in the name (if given as a list) can + only be higher than 255 if the Erlang Virtual Machine is started + in Unicode filename translation mode. Otherwise the name of the executable is limited to the ISO-latin-1 character set.
Starts an external program.
Starts an external program.
When starting external programs on Solaris, the system
call
For external programs, the
For external programs,
Works like
Works like
The shell is not usually invoked to start the
- program, it's executed directly. Neither is the
-
The shell is usually not invoked to start the
+ program, it is executed directly.
Only if a shell script or
If the
If
Messages are preceded by their length, sent in
Messages are delivered on a per line basis. Each line
- (delimited by the OS-dependent newline sequence) is
- delivered in one single message. The message data format
- is
The
The
This is only valid for
Only valid for
This is only valid for
Only valid for
This option is only valid for
Only valid for
The arguments are not expanded by the shell prior to
- being supplied to the executable, most notably this
- means that file wildcard expansion will not happen. Use
-
The arguments are not expanded by the shell before
+ being supplied to the executable. Most notably this
+ means that file wildcard expansion does not happen.
+ To expand wildcards for the arguments, use
+
Note also that the actual executable name (a.k.a.
If one, for any reason, wants to explicitly set the
- program name in the argument vector, the
The executable name (also known as
If you explicitly want to set the
+ program name in the argument vector, option
This option is only valid for
Only valid for
This is only valid for
Only valid for
When the external process connected to the port exits, a
message of the form
If the
If the port program closes its stdout without exiting,
- the
If option
If the port program closes its
This is only valid for
Only valid for
The opposite of
The opposite of
Affects ports to external programs on Windows® only. - The standard input and standard output handles of the port program - will, if this option is supplied, be opened with the flag - FILE_FLAG_OVERLAPPED, so that the port program can (and has to) do +
Affects ports to external programs on Windows only. The
+ standard input and standard output handles of the port program
+ are, if this option is supplied, opened with flag
+
All IO from the port are binary data objects as opposed +
All I/O from the port is binary data objects as opposed to lists of bytes.
The port will not be closed at the end of the file and
- produce an exit signal. Instead, it will remain open and
- a
The port is not closed at the end of the file and does not
+ produce an exit signal. Instead, it remains open and
+ a
When running on Windows, suppress creation of a new +
When running on Windows, suppresses creation of a new console window when spawning the port program. (This option has no effect on other platforms.)
Set scheduler hint for port parallelism. If set to
Sets scheduler hint for port parallelism. If set to
+
The default is
Default is
Failure: If the port cannot be opened, the exit reason is
-
Bad input arguments to
All available ports in the Erlang emulator are in use.
+There was not enough memory to create the port.
+There are no more available operating system processes.
+The external command given was too long.
+There are no more available file descriptors (for the operating system process - that the Erlang emulator runs in).
+The file table is full (for the entire operating system).
+The
The
During use of a port opened using
The maximum number of ports that can be open at the same
- time can be configured by passing the
-
Portable hash function that will give the same hash for +
Portable hash function that gives the same hash for
the same Erlang term regardless of machine architecture and
- ERTS version (the BIF was introduced in ERTS 4.9.1.1). Range
- can be between 1 and 2^32, the function returns a hash value
- for
This BIF could be used instead of the old deprecated
-
This BIF can be used instead of the old deprecated BIF
+
Portable hash function that will give the same hash for +
Portable hash function that gives the same hash for
the same Erlang term regardless of machine architecture and
- ERTS version (the BIF was introduced in ERTS 5.2). Range can
- be between 1 and 2^32, the function returns a hash value for
-
This BIF should always be used for hashing terms. It
+
This BIF is always to be used for hashing terms. It
distributes small integers better than
Note that the range
Notice that the range
Returns a string which corresponds to the text +
Returns a string corresponding to the text
representation of
This BIF is intended for debugging and for use in - the Erlang operating system. It should not be used in - application programs.
+This BIF is intended for debugging and for use in the + Erlang OS. It is not to be used in application programs.
Closes an open port. Roughly the same as
-
For comparison:
Note that any process can close a port using
-
Notice that any process can close a port using
+
As of OTP-R16
As from OTP R16,
Failure:
-Failure:
Sends data to a port. Same as
-
For comparison:
Note that any process can send to a port using
-
If the port is busy, the calling process will be suspended - until the port is not busy anymore.
-As of OTP-R16
Notice that any process can send to a port using
+
If the port is busy, the calling process is suspended + until the port is not busy any more.
+As from OTP-R16,
Failures:
Sends data to a port.
If the port command is aborted
If the port is busy, the calling process will be suspended - until the port is not busy anymore.
-Currently the following
If the port command is aborted,
If the port is busy, the calling process is suspended + until the port is not busy any more.
+The following
More options may be added in the future.
+More options can be added in a future release.
Failures:
Sets the port owner (the connected port) to
The error behavior differs, see below.
+The error behavior differs, see the following.
The port does not reply with
The new port owner gets linked to the port.
The old port owner stays linked to the port and have to call
-
The old port owner stays linked to the port and must call
+
For comparison:
For comparison:
+
Note that any process can set the port owner using
-
Notice that any process can set the port owner using
+
As of OTP-R16
As from OTP-R16,
+
Failures:
Performs a synchronous control operation on a port.
- The meaning of
Returns: a list of integers in the range 0 through 255, or a +
Returns a list of integers in the range 0..255, or a binary, depending on the port driver. The meaning of the returned data also depends on the port driver.
-Failure:
Failures:
+Performs a synchronous call to a port. The meaning of
-
Returns: a term from the driver. The meaning of the returned +
Returns a term from the driver. The meaning of the returned data also depends on the port driver.
Failures:
Returns a list containing tuples with information about
- the
Currently the result will containt information about the
- following
The result contains information about the following
+
For more information about the different
Failure:
If the port identified by
Failure:
If the port identified by
Failure:
If the port identified by
Failure:
If the port identified by
Failure:
Notice that these results are highly implementation-specific + and can change in a future release.
If the port identified by
Failure:
If the port identified by
Failure:
If the port identified by
Failure:
If the port identified by
Failure:
If the port identified by
Failure:
If the port identified by
Failure:
If the port identified by
Failure:
If the port identified by
Failure:
Returns a string which corresponds to the text +
Returns a string corresponding to the text
representation of the port identifier
This BIF is intended for debugging and for use in - the Erlang operating system. It should not be used in - application programs.
+This BIF is intended for debugging and for use in the + Erlang OS. It is not to be used in application programs.
Returns a list of port identifiers corresponding to all the - ports currently existing on the local node.
- -Note that a port that is exiting, exists but is not open.
+ ports existing on the local node. +Notice that an exiting port exists, but is not open.
Returns a list of Erlang modules which are pre-loaded in +
Returns a list of Erlang modules that are preloaded in
the system. As all loading of code is done through the file
system, the file system must have been loaded previously.
- Hence, at least the module
Writes information about the local process
When
Returns the old value of the flag.
See also
This is used by a process to redefine the error handler +
Used by a process to redefine the error handler for undefined function calls and undefined registered - processes. Inexperienced users should not use this flag - since code auto-loading is dependent on the correct + processes. Inexperienced users are not to use this flag, + as code auto-loading depends on the correct operation of the error handling module.
Returns the old value of the flag.
This changes the minimum heap size for the calling - process.
+Changes the minimum heap size for the calling process.
Returns the old value of the flag.
This changes the minimum binary virtual heap size for the calling +
Changes the minimum binary virtual heap size for the calling process.
-Returns the old value of the flag.
Returns the old value of the flag.
+Internally in each priority level processes are scheduled - in a round robin fashion. -
+ Sets the process priority.Priority level
Internally in each priority level, processes are scheduled + in a round robin fashion.
Execution of processes on priority
When there are runnable processes on priority
When there are runnable processes on priority
When there are runnable processes on priority
When there are runnable processes on priority
Scheduling is preemptive. Regardless of priority, a process
- is preempted when it has consumed more than a certain amount
+
Scheduling is pre-emptive. Regardless of priority, a process + is pre-empted when it has consumed more than a certain number of reductions since the last time it was selected for - execution. -
-NOTE: You should not depend on the scheduling + execution.
+Do not depend on the scheduling to remain exactly as it is today. Scheduling, at least on - the runtime system with SMP support, is very likely to be - modified in the future in order to better utilize available - processor cores. -
-There is currently no automatic mechanism for - avoiding priority inversion, such as priority inheritance, - or priority ceilings. When using priorities you have - to take this into account and handle such scenarios by - yourself. -
+ the runtime system with SMP support, is likely to be + changed in a future release to use available + processor cores better. +There is no automatic mechanism for + avoiding priority inversion, such as priority inheritance + or priority ceilings. When using priorities, + take this into account and handle such scenarios by + yourself.
Making calls from a
Other priorities than
Returns the old value of the flag.
If
Returns the old value of the flag.
Set or clear the
Sets or clears flag
Features that are disabled include (but are not limited to) the following:
-Tracing: Trace flags can still be set for the process, but no
- trace messages of any kind will be generated.
- (If the
Sequential tracing: The sequential trace token will be propagated - as usual, but no sequential trace messages will be generated.
-Stack back-traces cannot be displayed for the process.
In crash dumps, the stack, messages, and the process dictionary - will be omitted.
+ are omitted.If
Returns the old value of the flag.
Sets certain flags for the process
Sets certain flags for the process
Failure:
Failure:
Returns a list containing
- The order of the
See
The order of the
The
If the process identified by
For information about specific
This BIF is intended for debugging only, use
-
This BIF is intended for debugging only. For
+ all other purposes, use
+
Failure:
Failure:
Returns information about the process identified by
If the process is alive and a single
If an
If
Returns information about the process identified by
+
If the process is alive and a single
If
If
Currently the following
The following
The binary
Binary
Return the current call stack back-trace (stacktrace) +
Returns the current call stack back-trace (stacktrace)
of the process. The stack has the same format as returned by
-
A list of pids that are monitoring the process (with +
A list of process identifiers monitoring the process (with
A list of monitors (started by
Notice that
Note however, that not all implementations support every one
- of the above
Failure:
Notice that not all implementations support all
+ these
Failures:
+Returns a list of process identifiers corresponding to - all the processes currently existing on the local node. -
-Note that a process that is exiting, exists but is not alive, i.e.,
-
Notice that an exiting process exists, but is not alive.
+ That is,
Example:
> processes(). [<0.0.0>,<0.2.0>,<0.4.0>,<0.5.0>,<0.7.0>,<0.8.0>]
Removes old code for
Removes old code for
This BIF is intended for the code server (see
-
Failure:
Adds a new
The values stored when
Adds a new
Example:
> X = put(name, walrus), Y = put(name, carpenter),
Z = get(name),
{X, Y, Z}.
{undefined,walrus,carpenter}
+ The values stored when
Stops the execution of the calling process with an - exception of given class, reason and call stack backtrace + exception of given class, reason, and call stack backtrace (stacktrace).
This BIF is intended for debugging and for use in - the Erlang operating system. In general, it should - be avoided in applications, unless you know - very well what you are doing.
+ the Erlang OS. Avoid to use it in applications, + unless you really know what you are doing.The
Element
The stacktrace is used as the exception stacktrace for the - calling process; it will be truncated to the current + calling process; it is truncated to the current maximum stacktrace depth.
-Because evaluating this function causes the process to
- terminate, it has no return value - unless the arguments are
- invalid, in which case the function returns the error reason, that is
Since evaluating this function causes the process to
+ terminate, it has no return value unless the arguments are
+ invalid, in which case the function returns the error
+ reason
Read the state of a timer that has been created by either
@@ -4626,7 +4923,7 @@ os_prompt%
the timeout message has been sent, but it does not tell you
whether or not it has arrived at its destination yet. When the
@@ -4651,70 +4948,86 @@ os_prompt%
Read the state of a timer. The same as calling
Returns a string which corresponds to the text +
Returns a string corresponding to the text
representation of
This BIF is intended for debugging and for use in - the Erlang operating system. It should not be used in - application programs.
+This BIF is intended for debugging and for use in the + Erlang OS. It is not to be used in application programs.
Associates the name
Associates the name
Example:
> register(db, Pid). true-
Failure:
Failures:
+Returns a list of names which have been registered using
-
Returns a list of names that have been registered using
+
> registered(). [code_server, file_server, init, user, my_db]
Decreases the suspend count on the process identified by
-
This BIF is intended for debugging only.
Returns an integer by rounding
Returns an integer by rounding
-> round(5.5). +round(5.5). 6
Allowed in guard tests.
Returns the pid (process identifier) of the calling process.
+Returns the process identifier of the calling process, for + example:
> self(). <0.26.0>
Allowed in guard tests.
Sends a message and returns
Sends a message and returns
Sends a message and returns
The possible options are:
+Either sends a message and returns
The options are as follows:
If the destination node would have to be auto-connected
- before doing the send,
As with
As with
Starts a timer. The same as calling
The same as
-
This function is intended for send operations towards an +
This function is intended for send operations to an
unreliable remote node without ever blocking the sending
(Erlang) process. If the connection to the remote node
(usually not a real Erlang node, but a node written in C or
- Java) is overloaded, this function will not send the message but return
The same happens, if
The same occurs if
This function is only to be used in very rare circumstances +
This function is only to be used in rare circumstances
where a process communicates with Erlang nodes that can
- disappear without any trace causing the TCP buffers and
- the drivers queue to be over-full before the node will actually
- be shut down (due to tick timeouts) by
Note that ignoring the return value from this function would - result in unreliable message passing, which is +
Notice that ignoring the return value from this function would
+ result in an unreliable message passing, which is
contradictory to the Erlang programming model. The message is
not sent if this function returns
Note also that in many systems, transient states of +
In many systems, transient states of
overloaded queues are normal. The fact that this function
- returns
Use with extreme care!
+Use with extreme care.
The same as
-
This function behaves like
Whenever the function returns
Use with extreme care!
+Use with extreme care.
Sets the magic cookie of
Failure:
Returns a tuple which is a copy of the argument
Returns a tuple that is a copy of argument
+
> setelement(2, {10, green, bottles}, red).
{10,red,bottles}
Returns an integer which is the size of the argument
-
Returns an integer that is the size of argument
+
> size({morni, mulle, bwange}).
3
Allowed in guard tests.
Returns the pid of a new process started by the application
- of
Returns the process identifier of a new process started by the
+ application of
Returns the pid of a new process started by the application
- of
Returns the process identifier of a new process started
+ by the application of
Returns the pid of a new process started by the application
- of
Returns the process identifier of a new process started by
+ the application of
Example:
> spawn(speed, regulator, [high_speed, thin_cut]). <0.13.1>
Returns the pid of a new process started by the application
- of
Returns the process identifier (pid) of a new process started
+ by the application
+ of
Returns the pid of a new process started by the application
- of
Returns the process identifier of a new process started by
+ the application of
Returns the pid of a new process started by the application
- of
Returns the process identifier (pid) of a new process started
+ by the application of
Returns the pid of a new process started by the application
- of
Returns the process identifier of a new process started by
+ the applicatio of
Returns the pid of a new process started by the application
- of
Returns the process identifier (pid) of a new process
+ started by the application
+ of
Returns the pid of a new process started by the application
- of
Returns the process identifier of a new process, started by
+ the application of
A new process is started by the application
- of
Returns the pid of a new process started by the application
- of
Returns the process identifier (pid) of a new process
+ started by the application of
If the option
If option
Returns the pid of a new process started by the application
- of
Returns the process identifier (pid) of a new process started
+ by the application of
Works exactly like +
Works as
If the option
If option
The options are as follows:
Monitor the new process (just like +
Monitors the new process (like
Sets the priority of the new process. Equivalent to
executing
-
This option is only useful for performance tuning. - In general, you should not use this option unless you - know that there is problem with execution times and/or - memory consumption, and you should measure to make sure - that the option improved matters. -
+Useful only for performance tuning. Do not use this + option unless you + know that there is problem with execution times or + memory consumption, and ensure + that the option improves matters.
The Erlang runtime system uses a generational garbage collection scheme, using an "old heap" for data that has survived at least one garbage collection. When there is no more room on the old heap, a fullsweep garbage - collection will be done.
-The
Option
Here are a few cases when it could be useful to change
-
A few cases when it can be useful to change
+
This option is only useful for performance tuning. - In general, you should not use this option unless you - know that there is problem with execution times and/or - memory consumption, and you should measure to make sure - that the option improved matters. -
-Gives a minimum heap size in words. Setting this value - higher than the system default might speed up some +
Useful only for performance tuning. Do not use this + option unless you know that there is problem with + execution times or memory consumption, and + ensure that the option improves matters.
+Gives a minimum heap size, in words. Setting this value
+ higher than the system default can speed up some
processes because less garbage collection is done.
- Setting too high value, however, might waste memory and
- slow down the system due to worse data locality.
- Therefore, it is recommended to use this option only for
+ However, setting a too high value can waste memory and
+ slow down the system because of worse data locality.
+ Therefore, use this option only for
fine-tuning an application and to measure the execution
time with various
This option is only useful for performance tuning. - In general, you should not use this option unless you - know that there is problem with execution times and/or - memory consumption, and you should measure to make sure - that the option improved matters. -
-Gives a minimum binary virtual heap size in words. Setting this value - higher than the system default might speed up some +
Useful only for performance tuning. Do not use this + option unless you know that there is problem with + execution times or memory consumption, and + ensure that the option improves matters.
+Gives a minimum binary virtual heap size, in words.
+ Setting this value
+ higher than the system default can speed up some
processes because less garbage collection is done.
- Setting too high value, however, might waste memory.
- Therefore, it is recommended to use this option only for
+ However, setting a too high value can waste memory.
+ Therefore, use this option only for
fine-tuning an application and to measure the execution
time with various
Returns the pid of a new process started by the application
- of
Returns the process identifier (pid) of a new process started
+ by the application
+ of
The Option
Returns a tuple containing the binaries which are the result
- of splitting
Returns a tuple containing the binaries that are the result
+ of splitting
Example:
> B = list_to_binary("0123456789").
<<"0123456789">>
@@ -5228,9 +5606,10 @@ true
7
Starts a timer. When the timer expires, the message @@ -5268,7 +5647,7 @@ true is not allowed to be negative.
- If
- If
See also
@@ -5290,13 +5669,14 @@ true
Failure:
Failure:
Starts a timer. The same as calling
Returns the total number of context switches since the + system started.
Returns the number of exact reductions.
+This information may not be valid for all implementations.
+Returns information about garbage collection, for example:
> statistics(garbage_collection).
-{85,23961,0}
-
+{85,23961,0}
+ This information can be invalid for some implementations.
Returns
Since erts-5.5 (OTP release R11B)
- this value does not include reductions performed in current
- time slices of currently scheduled processes. If an
- exact value is wanted, use
-
Returns information about reductions, for example:
> statistics(reductions).
-{2046,11}
-
+{2046,11}
+ As from
Returns the total length of the run queues, that is, the number - of processes that are ready to run on all available run queues.
+Returns the total length of run-queues, that is, the number + of processes that are ready to run on all available run-queues.
Note that the run-time is the sum of the run-time for all - threads in the Erlang run-time system and may therefore be greater - than the wall-clock time. The time is returned in milliseconds.
+Returns information about runtime, in milliseconds.
+The runtime is the sum of the runtime for all threads + in the Erlang runtime system and can therefore be greater + than the wall clock time.
+Example:
> statistics(runtime).
-{1690,1620}
-
+{1690,1620}
- Returns a list of tuples with
The definition of a busy scheduler is when it is not idle or not - scheduling (selecting) a process or port, meaning; executing process - code, executing linked-in-driver or NIF code, executing - built-in-functions or any other runtime handling, garbage collecting - or handling any other memory management. Note, a scheduler may also be - busy even if the operating system has scheduled out the scheduler - thread. -
- -
- Returns
The list of scheduler information is unsorted and may appear in different order - between calls. -
-Using
Returns a list of tuples with
+
The definition of a busy scheduler is when it is not idle + and is not scheduling (selecting) a process or port, + that is:
+Notice that a scheduler can also be busy even if the + OS has scheduled out the scheduler thread.
+Returns
The list of scheduler information is unsorted and can + appear in different order between calls.
+Using
> erlang:system_flag(scheduler_wall_time, true). false > Ts0 = lists:sort(erlang:statistics(scheduler_wall_time)), ok. -ok --
Some time later we will take another snapshot and calculate scheduler-utilization per scheduler.
+ok +Some time later the user takes another snapshot and calculates + scheduler-use per scheduler, for example:
> Ts1 = lists:sort(erlang:statistics(scheduler_wall_time)), ok.
ok
@@ -5437,86 +5828,90 @@ ok
{5,0.9717956667018103},
{6,0.9739235846420741},
{7,0.973237033077876},
- {8,0.9741297293248656}]
-
- Using the same snapshots to calculate a total scheduler-utilization.
+ {8,0.9741297293248656}] +Using the same snapshots to calculate a total scheduler-use:
> {A, T} = lists:foldl(fun({{_, A0, T0}, {_, A1, T1}}, {Ai,Ti}) ->
{Ai + (A1 - A0), Ti + (T1 - T0)} end, {0, 0}, lists:zip(Ts0,Ts1)), A/T.
-0.9769136803764825
-
+0.9769136803764825
Returns information about wall clock.
Increases the suspend count on the process identified by
-
A process can be suspended by multiple processes and can
be suspended multiple times by a single process. A suspended
- process will not leave the suspended state until its suspend
- count reach zero. The suspend count of
Currently the following options (
The options (
If the suspend count on the process identified by
-
This BIF is intended for debugging only.
Suspends the process identified by
Suspends the process identified by
+
This BIF is intended for debugging only.
Sets the maximum depth of call stack back-traces in the
exit reason element of
Returns the old value of the flag.
When this argument is removed, a final CPU topology + to use will be determined at emulator boot time.
Sets the user defined
Sets the user-defined
Returns the old value of the flag.
The CPU topology is used when binding schedulers to logical processors. If schedulers are already bound when the CPU - topology is changed, the schedulers will be sent a request - to rebind according to the new CPU topology. -
-The user defined CPU topology can also be set by passing
- the
For information on the
The user-defined CPU topology can also be set by passing
+ command-line argument
+
For information on type
Returns the old value of the flag.
-Note that the number of dirty CPU schedulers online may change if the number of
- schedulers online changes. For example, if there are 12 schedulers and all are
- online, and 6 dirty CPU schedulers, all online as well, and
Note that the dirty schedulers functionality is experimental, and - that you have to enable support for dirty schedulers when building OTP in order - to try out the functionality.
-For more information see +
The number of dirty CPU schedulers online can change if the
+ number of schedulers online changes. For example, if 12
+ schedulers and 6 dirty CPU schedulers are online, and
+
The dirty schedulers functionality is experimental. + Enable support for dirty schedulers when building OTP to + try out the functionality.
+For more information, see
Sets system flag
Returns the old value of the flag.
In low-memory systems (especially without virtual
- memory), setting the value to 0 can help to conserve
+ memory), setting the value to
An alternative way to set this value is through the
- (operating system) environment variable
-
This value can also be set through (OS)
+ environment variable
Sets the default minimum heap size for processes. The
- size is given in words. The new Sets the default minimum heap size for processes. The size
+ is given in words. The new
Returns the old value of the flag.
Sets the default minimum binary virtual heap size for processes. The
- size is given in words. The new
Sets the default minimum binary virtual heap size for
+ processes. The size is given in words.
+ The new
Returns the old value of the flag.
If
If
One process can block multi-scheduling multiple times. + If a process has blocked multiple times, it must unblock exactly as many times as it has blocked before it has released its multi-scheduling block. If a process that - has blocked multi-scheduling exits, it will release its + has blocked multi-scheduling exits, it releases its blocking of multi-scheduling.
The return values are
NOTE: Blocking of multi-scheduling should normally - not be needed. If you feel that you need to - block multi-scheduling, think through the - problem at least a couple of times again. - Blocking multi-scheduling should only be used - as a last resort since it will most likely be - a very inefficient way to solve the - problem.
-See also
Blocking of multi-scheduling is normally not needed. + If you feel that you need to block multi-scheduling, + consider it a few more times again. Blocking multi-scheduling + is only to be used as a last resort, as it is most likely + a very inefficient way to solve the problem.
+See also
+
Controls if and how schedulers are bound to logical processors.
-When
Schedulers can currently only be bound on newer Linux, +
When
If a scheduler fails to bind, this is often silently
+ ignored, as it is not always possible to verify valid
+ logical processor identifiers. If an error is reported,
+ it is reported to
Schedulers can be bound on newer Linux, Solaris, FreeBSD, and Windows systems, but more systems will be - supported in the future. -
+ supported in future releases.In order for the runtime system to be able to bind schedulers,
- the CPU topology needs to be known. If the runtime system fails
- to automatically detect the CPU topology, it can be defined.
+ the CPU topology must be known. If the runtime system fails
+ to detect the CPU topology automatically, it can be defined.
For more information on how to define the CPU topology, see
- the
The runtime system will by default not bind schedulers - to logical processors. -
-NOTE: If the Erlang runtime system is the only - operating system process that binds threads to logical processors, - this improves the performance of the runtime system. However, - if other operating system processes (as for example another Erlang - runtime system) also bind threads to logical processors, there - might be a performance penalty instead. In some cases this - performance penalty might be severe. If this is the case, you - are advised to not bind the schedulers.
-Schedulers can be bound in different ways. The
The runtime system does by default not bind schedulers + to logical processors.
+If the Erlang runtime system is the only OS + process binding threads to logical processors, this + improves the performance of the runtime system. However, + if other OS processes (for example, another Erlang + runtime system) also bind threads to logical processors, + there can be a performance penalty instead. Sometimes this + performance penalty can be severe. If so, it is recommended + to not bind the schedulers.
+Schedulers can be bound in different ways. Argument
+
Same as the Same as command-line argument
+ Same as the Same as command-line argument
+ Same as the Same as command-line argument
+ Same as the Same as command-line argument
+ Same as the Same as command-line argument
+ Same as the Same as command-line argument
+ Same as the Same as command-line argument
+ Same as the Same as command-line argument
+ Same as the Same as command-line argument
+
The value returned equals
Failure:
+The returned value equals
Failures:
If
If
If no CPU topology information is available.
+If CPU topology information is unavailable.
The scheduler bind type can also be set by passing
- the
For more information, see
For more information see,
-
For more information, see
+
Returns the old value of the flag.
-Note that if the emulator was built with support for
For more information see,
-
The emulator was built with support for
+
For more information, see
+
Sets the value of the node's trace control word to
-
Sets the value of the node trace control word to
+
Returns the old value of the flag.
Finalizes the
- Returns various information about the
-
Returns various information about the allocators of the
current system (emulator) as specified by
Returns a list of tuples with information about miscellaneous allocated memory areas.
-Each tuple contains an atom describing type of memory as - first element and amount of allocated memory in bytes as - second element. In those cases when there is information - present about allocated and used memory, a third element - is present. This third element contains the amount of +
Each tuple contains an atom describing the type of + memory as first element and the amount of allocated + memory in bytes as second element. When information + about allocated and used memory is present, also a + third element is present, containing the amount of used memory in bytes.
Note: The sum of these values is not + for debugging, and the content is highly + implementation-dependent. The content of the results + therefore changes when needed without prior notice.
+Notice that the sum of these values is not
the total amount of memory allocated by the emulator.
Some values are part of other values, and some memory
- areas are not part of the result. If you are interested
- in the total amount of memory allocated by the emulator
- see
Returns
Explanation:
+Returns
See also "System Flags Effecting erts_alloc" in
Returns a list of the names of all allocators
- using the ERTS internal
Returns a list of the names of all allocators using
+ the
Returns information about the specified allocator.
- As of erts version 5.6.1 the return value is a list
- of
Note: The information returned is highly - implementation dependent and may be changed, or removed +
Notice that the information returned is highly + implementation-dependent and can be changed or removed at any time without prior notice. It was initially intended as a tool when developing new allocators, but - since it might be of interest for others it has been + as it can be of interest for others it has been briefly documented.
The recognized allocators are listed in
If only one value is present, it is the current value.
Returns various size information for the specified allocator. The information returned is a subset of the information returned by @@ -6066,103 +6484,103 @@ ok
Returns various information about the
-
Returns various information about the CPU topology of
+ the current system (emulator) as specified by
+
Returns the
Returns the
A level in the
A level in term
Returns the user defined
Returns the automatically detected
For more information see the documentation of the
-
Returns the user-defined
Returns the automatically detected
+
For more information, see argument
+
Returns the
Returns
Returns various information about the current system
(emulator) as specified by
Returns a list containing miscellaneous information - regarding the emulators internal I/O checking. Note, - the content of the returned list may vary between - platforms and over time. The only thing guaranteed is + about the emulators internal I/O checking. Notice that + the content of the returned list can vary between + platforms and over time. It is only guaranteed that a list is returned.
Returns the compatibility mode of the local node as
an integer. The integer returned represents the
- Erlang/OTP release which the current emulator has been
+ Erlang/OTP release that the current emulator has been
set to be backward compatible with. The compatibility
- mode can be configured at startup by using the command
- line flag
Returns
Returns the amount of time in seconds that garbage collection
of an entry in a node table will be delayed. This limit can be set
on startup by passing the
@@ -6302,124 +6718,130 @@ ok
flag to
Returns the number of dirty CPU scheduler threads used by the emulator. Dirty CPU schedulers execute CPU-bound - native functions such as NIFs, linked-in driver code, and BIFs - that cannot be managed cleanly by the emulator's normal schedulers. -
-The number of dirty CPU scheduler threads is determined at emulator
- boot time and cannot be changed after that. The number of dirty CPU
- scheduler threads online can however be changed at any time. The number of
- dirty CPU schedulers can be set on startup by passing
- the
Note that the dirty schedulers functionality is experimental, and - that you have to enable support for dirty schedulers when building OTP in - order to try out the functionality.
-See also
The number of dirty CPU scheduler threads is determined
+ at emulator boot time and cannot be changed after that.
+ However, the number of dirty CPU scheduler threads online
+ can be changed at any time. The number of dirty CPU
+ schedulers can be set at startup by passing
+ command-line flag
+
Notice that the dirty schedulers functionality is + experimental. Enable support for dirty schedulers when + building OTP to try out the functionality.
+See also
+
Returns the number of dirty CPU schedulers online. The return value
- satisfies the following relationship:
-
The number of dirty CPU schedulers online can be set on startup by passing
- the
Note that the dirty schedulers functionality is experimental, and - that you have to enable support for dirty schedulers when building OTP in - order to try out the functionality.
+Returns the number of dirty CPU schedulers online.
+ The return value satisfies
+
The number of dirty CPU schedulers online can be set at
+ startup by passing command-line flag
+
Notice that the dirty schedulers functionality is + experimental. Enable support for dirty schedulers when + building OTP to try out the functionality.
For more information, see
Returns the number of dirty I/O schedulers as an integer. Dirty I/O schedulers - execute I/O-bound native functions such as NIFs and linked-in driver code that - cannot be managed cleanly by the emulator's normal schedulers. -
-This value can be set on startup by passing
- the
Note that the dirty schedulers functionality is experimental, and - that you have to enable support for dirty schedulers when building OTP in - order to try out the functionality.
+Returns the number of dirty I/O schedulers as an integer. + Dirty I/O schedulers execute I/O-bound native functions, + such as NIFs and linked-in driver code, which cannot be + managed cleanly by the normal emulator schedulers.
+This value can be set at startup by passing command-line
+ argument
Notice that the dirty schedulers functionality is + experimental. Enable support for dirty schedulers when + building OTP to try out the functionality.
For more information, see
Returns a binary containing a string of distribution
information formatted as in Erlang crash dumps. For more
- information see the
Returns the value of the distribution buffer busy limit
- in bytes. This limit can be set on startup by passing the
-
Returns a list of tuples
-
Returns a string containing the erlang driver version - used by the runtime system. It will be on the form +
Returns a string containing the Erlang driver version
+ used by the runtime system. It has the form
Returns an atom describing the dynamic trace framework
- compiled into the virtual machine. It can currently be either
-
Returns a
Returns a
This option will be removed in a future release.
- The return value will always be
Returns the maximum number of ETS tables allowed. This limit
- can be increased on startup by passing the
Returns the maximum number of ETS tables allowed. This
+ limit can be increased at startup by passing
+ command-line flag
+
Returns
Returns
Returns a list describing the default garbage collection
settings. A process spawned on the local node by a
-
Returns the heap type used by the current emulator. - Currently only the following heap type exists:
+Returns the heap type used by the current emulator. One + heap type exists:
Returns a binary containing a string of miscellaneous
system information formatted as in Erlang crash dumps.
- For more information see the
-
Returns
Returns a binary containing a string of loaded module
information formatted as in Erlang crash dumps. For more
- information see the
Returns the detected number of logical processors configured
- on the system. The return value is either an integer, or
- the atom
Returns the detected number of logical processors available to
- the Erlang runtime system. The return value is either an
- integer, or the atom
Returns the detected number of logical processors available
+ to the Erlang runtime system. The return value is either an
+ integer, or the atom
Returns the detected number of logical processors online on
the system. The return value is either an integer,
- or the atom
Returns
Returns
Returns
Returns
Returns the modified timing level (an integer) if
- modified timing has been enabled; otherwise,
-
Returns the modified timing-level (an integer) if
+ modified timing is enabled, otherwise,
Returns
Returns
The emulator has more than one scheduler thread, - but all scheduler threads but one have been blocked, - i.e., only one scheduler thread will schedule - Erlang processes and execute Erlang code.
+ but all scheduler threads except one are blocked, + that is, only one scheduler thread schedules + Erlang processes and executes Erlang code.The emulator has more than one scheduler thread, - and no scheduler threads have been blocked, i.e., - all available scheduler threads will schedule + and no scheduler threads are blocked, that is, + all available scheduler threads schedule Erlang processes and execute Erlang code.
See also
See also
+
Returns a list of
Returns a list of
See also
See also
+
Returns a string containing the erlang NIF version used by the runtime system. It will be on the form "<major ver>.<minor ver>".
Returns a string containing the OTP release number of the
- OTP release that the currently executing ERTS application is
+ OTP release that the currently executing
As of OTP release 17, the OTP release number corresponds to
- the major OTP version number. There is no
-
As from OTP 17, the OTP release number corresponds to
+ the major OTP version number. No
+
Returns the default port parallelism scheduling hint used.
- For more information see the
-
Returns the default port parallelism scheduling hint used.
+ For more information, see command-line argument
+
Returns the number of ports currently existing at
- the local node as an integer. The same value as
-
Returns the number of ports currently existing at the
+ local node. The value is given as an integer. This is
+ the same value as returned by
+
Returns the maximum number of simultaneously existing
- ports at the local node as an integer. This limit
- can be configured at startup by using the
-
Returns the number of processes currently existing at
- the local node as an integer. The same value as
-
Returns the number of processes currently existing at the
+ local node. The value is given as an integer. This is
+ the same value as returned by
+
Returns the maximum number of simultaneously existing
- processes at the local node as an integer. This limit
- can be configured at startup by using the
-
Returns a binary containing a string of process and port
information formatted as in Erlang crash dumps. For more
- information see the
Returns information on how user has requested
+
Returns information about how the user has requested schedulers to be bound or not bound.
-NOTE: Even though user has requested
- schedulers to be bound, they might have silently failed
- to bind. In order to inspect actual scheduler bindings call
-
For more information, see
- the
Returns information on currently used scheduler +
Notice that even though a user has requested
+ schedulers to be bound, they can silently have failed
+ to bind. To inspect the scheduler bindings, call
+
For more information, see command-line argument
+
Returns information about the currently used scheduler bindings.
A tuple of a size equal to
-
Note that only schedulers online can be bound to logical + process is executing on.
+Notice that only schedulers online can be bound to logical processors.
-For more information, see
- the
For more information, see command-line argument
+
Returns the scheduler id (
Returns the scheduler ID (
Returns the number of scheduler threads used by the emulator. Scheduler threads online schedules Erlang processes and Erlang ports, and execute Erlang code - and Erlang linked in driver code.
+ and Erlang linked-in driver code.The number of scheduler threads is determined at - emulator boot time and cannot be changed after - that. The amount of schedulers online can - however be changed at any time.
-See also
See also
+
Returns the amount of schedulers online. The scheduler
- identifiers of schedulers online satisfy the following
- relationship:
-
Returns the number of schedulers online. The scheduler
+ identifiers of schedulers online satisfy the relationship
+
For more information, see
-
Returns
The Returns a string containing version number and
- some important properties such as the number of schedulers.
Returns
Returns the number of async threads in the async thread
pool used for asynchronous driver calls
- (
Returns a boolean value indicating whether
+
+ Returns a boolean value indicating whether
Returns the state of the time offset: Returns the state of the time offset: The time offset is preliminary, and will be changed
@@ -6949,8 +7393,9 @@ ok
time warp mode is being used. Returns whether a pre erts-7.0 backwards compatible compensation
for sudden changes of system time is Returns the value of the node's trace control word.
- For more information see documentation of the function
- Returns the value of the node trace control word. For
+ more information, see function The runtime system rereads the CPU information available and
- updates its internally stored information about the
- The runtime system rereads the CPU information available
+ and updates its internally stored information about the
+ If the CPU information has changed since the last time
+ it was read, the atom
Returns a string containing the version number of the emulator.
Same as
Same as
Returns the size of Erlang term words in bytes as an - integer, i.e. on a 32-bit architecture 4 is returned, - and on a pure 64-bit architecture 8 is returned. On a + integer, that is, 4 is returned on a 32-bit architecture, + and 8 is returned on a pure 64-bit architecture. On a halfword 64-bit emulator, 4 is returned, as the Erlang - terms are stored using a virtual wordsize of half the - system's wordsize.
+ terms are stored using a virtual word size of half the + system word size.Returns the true wordsize of the emulator, i.e. the size - of a pointer, in bytes as an integer. On a pure 32-bit - architecture 4 is returned, on both a halfword and pure +
Returns the true word size of the emulator, that is, + the size of a pointer. The value is given in bytes + as an integer. On a pure 32-bit architecture, 4 is + returned. On both a half word and on a pure 64-bit architecture, 8 is returned.
The
Argument
Returns the current system monitoring settings set by
When called with the argument
When called with argument
Calling the function with
Calling the function with
Returns the previous system monitor settings just like
Sets system performance monitoring options.
Sets the system performance monitoring options.
+
If a garbage collection in the system takes at least
-
One of the tuples is
If a process or port in the system runs uninterrupted +
If a process or port in the system runs uninterrupted
for at least
If a
If a
This can be used to detect problems with NIF's or - drivers that take too long to execute. Generally, 1 ms - is considered a good maximum time for a driver callback - or a NIF. However, a time sharing system should usually - consider everything below 100 ms as "possible" and - fairly "normal". Schedule times above that might however - indicate swapping or a NIF/driver that is - misbehaving. Misbehaving NIF's and drivers could cause - bad resource utilization and bad overall performance of - the system.
+This can be used to detect problems with NIFs or + drivers that take too long to execute. 1 ms is + considered a good maximum time for a driver callback + or a NIF. However, a time-sharing system is usually to + consider everything below 100 ms as "possible" and + fairly "normal". However, longer schedule times can + indicate swapping or a misbehaving NIF/driver. + Misbehaving NIFs and drivers can cause bad resource + use and bad overall system performance.
If a garbage collection in the system results in
the allocated size of a heap being at least
As of
If a process in the system gets suspended because it
sends to a busy port, a message
If a monitoring process gets so large that it itself starts to cause system monitor messages when garbage - collecting, the messages will enlarge the process's + collecting, the messages enlarge the process message queue and probably make the problem worse.
Keep the monitoring process neat and do not set the system monitor limits too tight.
Failure:
Failures:
+Returns the current system profiling settings set by
Sets system profiler options.
- If a synchronous call to a port from a process is done, the +
If a synchronous call to a port from a process is done, the
calling process is considered not runnable during the call
runtime to the port. The calling process is notified as
-
If a process is put into or removed from the run queue a message,
-
If a process is put into or removed from the run queue, a
+ message,
If a port is put into or removed from the run queue a message,
-
If a port is put into or removed from the run queue, a
+ message,
If a scheduler is put to sleep or awoken a message,
-
If a scheduler is put to sleep or awoken, a message,
+
Returns a binary data object which is the result of encoding
-
This can be used for a variety of purposes, for example +
Returns a binary data object that is the result of encoding
+
This can be used for various purposes, for example, writing a term to a file in an efficient way, or sending an Erlang term to some type of communications channel not supported by distributed Erlang.
@@ -7288,67 +7738,81 @@ okReturns a binary data object which is the result of encoding
-
If the option
It is also possible to specify a compression level by giving
- the option
Currently,
The option
Returns a binary data object that is the result of encoding
+ If option A compression level can be specified by giving option
+ Option As from OTP 17.0, As from OTP R11B-4, See also
+
+
A non-local return from a function. If evaluated within a
-
Example:
> catch throw({hello, there}).
{hello,there}
Failure:
Returns the current time as
The time zone and daylight saving time correction depend on +
The time zone and Daylight Saving Time correction depend on the underlying OS.
+Example:
> time().
{9,42,44}
Returns the tail of
Returns the tail of
> tl([geesties, guilies, beasties]). [guilies, beasties]
Allowed in guard tests.
-Failure:
Failure:
Turns on (if
All processes currently existing.
+All currently existing processes.
All processes that will be created in the future.
+All processes that are created in the future.
All currently existing processes and all processes that - will be created in the future.
+ are created in the future.Set all trace flags except
Sets all trace flags except
Trace sending of messages.
-Message tags:
Traces sending of messages.
+Message tags:
Trace receiving of messages.
+Traces receiving of messages.
Message tags:
Trace process related events.
+Traces process-related events.
Message tags:
Trace certain function calls. Specify which function +
Traces certain function calls. Specify which function
calls to trace by calling
Message tags:
Message tags:
Used in conjunction with the
Used with the
Silent mode is inhibited by executing
The
Message tags:
Message tags:
Used in conjunction with the
Used with the
The semantics is that a trace message is sent when a
- call traced function actually returns, that is, when a
- chain of tail recursive calls is ended. There will be
- only one trace message sent per chain of tail recursive
- calls, why the properties of tail recursiveness for
+ call traced function returns, that is, when a
+ chain of tail recursive calls ends. Only one trace
+ message is sent per chain of tail recursive calls,
+ so the properties of tail recursiveness for
function calls are kept while tracing with this flag.
Using
To get trace messages containing return values from
- functions, use the
Message tags:
Trace scheduling of processes.
-Message tags:
Traces scheduling of processes.
+Message tags:
Trace scheduling of an exiting processes.
+Traces scheduling of exiting processes.
Message tags:
Trace garbage collections of processes.
-Message tags:
Traces garbage collections of processes.
+Message tags:
Include a time stamp in all trace messages. The time - stamp (Ts) is of the same form as returned by +
Includes a time-stamp in all trace messages. The
+ time-stamp (Ts) has the same form as returned by
A global trace flag for the Erlang node that makes all
- trace timestamps be in CPU time, not wallclock. It is
- only allowed with
Used in conjunction with the
Used with the
Makes any process created by a traced process inherit
- its trace flags, including the
Makes the first process created by a traced process
- inherit its trace flags, excluding
- the
Makes any process linked by a traced process inherit its
- trace flags, including the
Makes the first process linked to by a traced process
- inherit its trace flags, excluding
- the
Specify where to send the trace messages.
Specifies where to send the trace messages.
If the
If flag
If the
If flag
When
When
When
When
When
When
When
Note that the trace flag
Trace flag
When
When
When
When
Note that
When
When
When
When
Sent when garbage collection is about to be started.
All sizes are in words.
Sent when garbage collection is finished.
If the tracing process dies, the flags will be silently +
If the tracing process dies, the flags are silently removed.
-Only one process can trace a particular process. For this - reason, attempts to trace an already traced process will fail.
+Only one process can trace a particular process. Therefore, + attempts to trace an already traced process fail.
Returns: A number indicating the number of processes that
- matched
Failure: If specified arguments are not supported. For
- example
Failure:
The delivery of trace messages is dislocated on the time-line
- compared to other events in the system. If you know that the
-
Note that the
Notice that message
Note that
Notice that that
An example: Process
Example: Process
Failure:
Failure:
Returns trace information about a process or function.
-To get information about a process,
To get information about a process,
+
The following
Return a list of atoms indicating what kind of traces is - enabled for the process. The list will be empty if no +
Returns a list of atoms indicating what kind of traces is
+ enabled for the process. The list is empty if no
traces are enabled, and one or more of the followings
atoms if traces are enabled:
Return the identifier for process or port tracing this +
Returns the identifier for process or port tracing this
process. If this process is not being traced, the return
- value will be
To get information about a function,
To get information about a function,
The following
Return
Returns
Return the match specification for this function, if it +
Returns the match specification for this function, if it
has one. If the function is locally or globally traced but
has no match specification defined, the returned value
is
Return the meta trace tracer process or port for this
- function, if it has one. If the function is not meta
- traced the returned value is
Returns the meta-trace tracer process or port for this
+ function, if it has one. If the function is not
+ meta-traced, the returned value is
Return the meta trace match specification for this - function, if it has one. If the function is meta traced +
Returns the meta-trace match specification for this
+ function, if it has one. If the function is meta-traced
but has no match specification defined, the returned
value is
Return the call count value for this function or +
Returns the call count value for this function or
Return the call time values for this function or +
Returns the call time values for this function or
Return a list containing the
Returns a list containing the
+
The actual return value will be
The return value is
If
If
The same as
This BIF is used to enable or disable call tracing for - exported functions. It must be combined with +
Enables or disables call tracing for
+ exported functions. Must be combined with
Conceptually, call tracing works like this: Inside - the Erlang virtual machine there is a set of processes to be - traced and a set of functions to be traced. Tracing will be +
Conceptually, call tracing works as follows. Inside + the Erlang Virtual Machine, a set of processes and + a set of functions are to be traced. Tracing is enabled on the intersection of the set. That is, if a process included in the traced process set calls a function included - in the traced function set, the trace action will be taken. - Otherwise, nothing will happen.
-Use
-
The
To add or remove one or more processes to the set of traced
+ processes, use
+
To add or remove exported functions to the set of traced
+ functions, use
The BIF
The
Argument
Other combinations, such as
If the
If argument
The
Argument
Disable tracing for the matching function(s). Any match - specification will be removed.
+Disables tracing for the matching function or functions. + Any match specification is removed.
Enable tracing for the matching function(s).
+Enables tracing for the matching function or functions.
A list of match specifications. An empty list is
- equivalent to
For the
For the
For the
For the
The
Parameter
Turn on or off call tracing for global function calls +
Turns on or off call tracing for global function calls (that is, calls specifying the module explicitly). Only - exported functions will match and only global calls will + exported functions match and only global calls generate trace messages. This is the default.
Turn on or off call tracing for all types of function - calls. Trace messages will be sent whenever any of +
Turns on or off call tracing for all types of function
+ calls. Trace messages are sent whenever any of
the specified functions are called, regardless of how they
- are called. If the
Turn on or off meta tracing for all types of function - calls. Trace messages will be sent to the tracer process +
Turns on or off meta-tracing for all types of function
+ calls. Trace messages are sent to the tracer process
or port
Meta tracing traces all processes and does not care
+ If no
Meta-tracing traces all processes and does not care
about the process trace flags set by
The match spec function
The match specification function
Starts (
If call count tracing is started while already running,
- the count is restarted from zero. Running counters can be
- paused with
The counter value can be read with +
To read the counter value, use
Starts (
If call time tracing is started while already running,
- the count and time is restarted from zero. Running counters can be
- paused with
The counter value can be read with +
To read the counter value, use
The
The options
When disabling trace, the option must match the type of trace
- that is set on the function, so that local tracing must be
- disabled with the
There is no way to directly change part of a match
- specification list. If a function has a match specification,
- you can replace it with a completely new one. If you need to
- change an existing match specification, use the
+ set on the function. That is, local tracing must be
+ disabled with option
Part of a match specification list cannot be changed directly.
+ If a function has a match specification, it can be replaced
+ with a new one. To change an existing match specification,
+ use the BIF
Returns the number of exported functions that matched
- the
Returns the number of exported functions matching
+ argument
Returns an integer by the truncating
Returns an integer by truncating
> trunc(5.5). 5
Allowed in guard tests.
Returns an integer which is the number of elements in
Returns an integer that is the number of elements in
+
> tuple_size({morni, mulle, bwange}).
3
Allowed in guard tests.
Returns a list which corresponds to
Returns a list corresponding to
Example:
> tuple_to_list({share, {'Ericsson_B', 163}}).
[share,{'Ericsson_B',163}]
Returns the current date and time according to Universal
- Time Coordinated (UTC), also called GMT, in the form
+ Time Coordinated (UTC) in the form
Example:
> erlang:universaltime().
{{1996,11,6},{14,18,43}}
Converts Universal Time Coordinated (UTC) date and time to
- local date and time, if this is supported by the underlying
- OS. Otherwise, no conversion is done, and
+ local date and time in the form
+
Example:
> erlang:universaltime_to_localtime({{1996,11,6},{14,18,43}}).
{{1996,11,7},{15,18,43}}
- Failure:
Failure:
Removes the link, if there is one, between the calling
- process and the process or port referred to by
Returns
Once
Once
Notice that the
-
unlink(Id),
receive
{'EXIT', Id, _} ->
@@ -8320,23 +8823,25 @@ timestamp() ->
true
end
Prior to OTP release R11B (erts version 5.5)
Before OTP R11B (
Current behavior can be viewed as two combined operations: +
The current behavior can be viewed as two combined operations: asynchronously send an "unlink signal" to the linked entity and ignore any future results of the link.
Removes the registered name
Removes the registered name
> unregister(db). true@@ -8345,31 +8850,34 @@ true name.
Returns the pid or port identifier with the registered name
-
Returns the process identifier or port identifier with
+ the registered name
Example:
> whereis(db). <0.43.0>
Voluntarily let other processes (if any) get a chance to +
Voluntarily lets other processes (if any) get a chance to
execute. Using
There is seldom or never any need to use this BIF, - especially in the SMP-emulator as other processes will have a - chance to run in another scheduler thread anyway. - Using this BIF without a thorough grasp of how the scheduler - works may cause performance degradation.