tsnkit.core package¶
Submodules¶
tsnkit.core._calculate module¶
Author: Chuanyu (skewcy@gmail.com) _calculate.py (c) 2023 Desc: description Created: 2023-10-08T04:36:18.116Z
tsnkit.core._common module¶
Author: Chuanyu (skewcy@gmail.com) _common.py (c) 2023 Desc: description Created: 2023-10-08T17:51:27.418Z
tsnkit.core._config module¶
Author: Chuanyu (skewcy@gmail.com) _schedule.py (c) 2023 Desc: description Created: 2023-10-08T06:13:56.911Z
- class tsnkit.core._config.Delay(init_list: List[List])[source]¶
Bases:
listA list of [stream_id, frame_id, delay]
- class tsnkit.core._config.GCL(init_list: List[List])[source]¶
Bases:
listA list of [link, queue, start, end, cycle]
- Args:
init_list (List[List[link, queue, start, end, cycle]]): [description]
- class tsnkit.core._config.Queue(init_list: List[List])[source]¶
Bases:
listA list of [stream_id, frame_id, link, queue]
- Args:
init_list (List[List[stream_id, frame_id, link, queue]]): [description]
- class tsnkit.core._config.Release(init_list: List[List])[source]¶
Bases:
listA list of [stream_id, frame_id, release_time]
- class tsnkit.core._config.Route(init_list: List[List])[source]¶
Bases:
listA list of [stream_id, link] Each stream can contains several links as its route
tsnkit.core._constants module¶
Author: Chuanyu (skewcy@gmail.com) _constants.py (c) 2023 Desc: description Created: 2023-10-21T02:24:36.212Z
tsnkit.core._io module¶
Author: Chuanyu (skewcy@gmail.com) _io.py (c) 2023 Desc: description Created: 2023-10-08T06:13:41.041Z
- class tsnkit.core._io.Result(value)[source]¶
Bases:
Enum- error = -1¶
- schedulable = 1¶
- unknown = 2¶
- unschedulable = 0¶
- class tsnkit.core._io.Statistics(name: str = '-', result: Result = Result.unknown, algo_time: float = 0, algo_mem: float = 0, extra_time: float = 0, extra_mem: float = 0)[source]¶
Bases:
object- output_format = '| {:<13} | {:<13} | {:<6} | {:<10} | {:<10} | {:<10}'¶
tsnkit.core._network module¶
Author: Chuanyu (skewcy@gmail.com) _network.py (c) 2023 Desc: description Created: 2023-10-08T06:13:46.561Z
- class tsnkit.core._network.Link(*args, **kwargs)[source]¶
Bases:
intUse simple link structure to improve the efficiency
The overload __hash__ and __eq__ function is used to achieve flexible interface. -> Use (0, 1), Link(src=0, dst=1), (Node(0), Node(1)) are equivalent in framework.
- property dst¶
- property name¶
- property q_num¶
- property rate¶
- property src¶
- property t_proc¶
- property t_prop¶
- property t_sync¶
- class tsnkit.core._network.Network[source]¶
Bases:
object- property max_t_proc: int¶
- property net_np¶
- property net_nx¶
- property num_l: int¶
- property num_n: int¶
- class tsnkit.core._network.Node(*args, **kwargs)[source]¶
Bases:
int- property num_port¶
- property sync_error¶
- property type¶
- class tsnkit.core._network.NodeType(value)[source]¶
Bases:
EnumSample enum class for node type
- es = 1¶
- sw = 0¶
- class tsnkit.core._network.Path(path: List[int | Node | Tuple[int | Node, int | Node] | Link], network: Network)[source]¶
Bases:
objectA path can be either a node path or a link path Initialize with node path or link path, the other one will be automatically
No iterator interface to avoid misuse
- property links¶
- property llen¶
- property nlen¶
- property nodes¶
tsnkit.core._stream module¶
Author: Chuanyu (skewcy@gmail.com) _stream.py (c) 2023 Desc: description Created: 2023-10-08T06:14:04.079Z
- class tsnkit.core._stream.Stream(*args, **kwargs)[source]¶
Bases:
int- property deadline¶
- property dst¶
- property dst_mul¶
- property jitter¶
- property period¶
- property size¶
- property src¶
- property t_trans: int¶
- property t_trans_1g: int¶
Return max(transmission time on all links) Only used for uniform link rate assuming 1Gbps link rate. [NOTE]: This method it depreciated.
- Returns:
int: _description_
- class tsnkit.core._stream.StreamSet[source]¶
Bases:
object- get_frame_index_pairs(s1: int | Stream, s2: int | Stream)[source]¶
Get all frame index pairs of two streams. LCM is calculated from s1.period and s2.period
- Args:
s1 (Union[int, Stream]): _description_ s2 (Union[int, Stream]): _description_
- Returns:
_type_: _description_
- get_merged_links(s1: int | Stream, s2: int | Stream) List[Tuple[Link, Link, Link]][source]¶
This function is often used in queue isolation constraint. Example:
Path1 = (a, b), (b, c) Path2 = (d, b), (b, c)
return [((a, b), (d, b), (b, c))]
- Returns:
List[Tuple[Link1, Link2, Link3]]: Link1 and Link2 are the previous links of Link3. Link1, Link3 are in s1.Path Link2, Link3 are in s2.Path.
- get_next_link(stream: int | Stream, link: int | Link | Tuple[int | Node, int | Node]) Link | None[source]¶
- get_pairs_on_link(link: int | Link | Tuple[int | Node, int | Node], permute: bool = False) List[Tuple[Stream, Stream]][source]¶
Return all pairs of streams that share the same link
- Args:
link (FlexLink): _description_ permute (bool, optional): _description_. Defaults to False. -> only return (i, j) where i < j
- Raises:
Exception: _description_
- Returns:
List[Tuple[Stream, Stream]]: _description_
- get_prev_link(stream: int | Stream, link: int | Link | Tuple[int | Node, int | Node]) Link | None[source]¶
- property lcm¶
- property length: int¶
- property num_frames: int¶
- set_routing(stream: int | Stream, routing_path: Path) None[source]¶
_summary_
- Args:
stream (_type_): Stream_id or Stream object routing_path (_type_): Must be Path Object
- set_routings(routings: Dict[int | Stream, Path] | List[Path])[source]¶
_summary_
- Args:
routings (_type_): Must be either dict of {stream_id: Path} or list of [Path] where
- property streams¶
tsnkit.core._system module¶
Author: Chuanyu (skewcy@gmail.com) _system.py (c) 2023 Desc: description Created: 2023-10-08T06:14:11.998Z
- tsnkit.core._system.kill_if(main_proc: int, mem_limit: int, time_limit: int, sig: SynchronizedBase)[source]¶
Kill the process if it uses more than mem memory or more than time seconds Args:
main_proc: the main process id mem_limit: the memory limit, uint: GB time_limit: the time limit, uint: seconds
Module contents¶
Author: Chuanyu (skewcy@gmail.com) __init__.py (c) 2023 Desc: description Created: 2023-10-06T17:54:47.806Z