示例#1
0
    def _verify_input_args(self):
        """Verify and adjust the constructor input arguments."""

        if not self._ldist:
            self._ldist = "5000, 10000"

        self._ldist = _Common.validate_ldist(self._ldist)

        # Validate the 'ndlrunner' helper path.
        if not FSHelpers.isexe(self._ndlrunner_bin, proc=self._proc):
            raise Error(
                f"bad 'ndlrunner' helper path '{self._ndlrunner_bin}' - does not exist"
                f"{self._proc.hostmsg} or not an executable file")
示例#2
0
    def set_post_trigger(self, path, trange=None):
        """
        Configure the post-trigger - a program that has to be executed after a datapoint is
        collected. The arguments are as follows.
          * path - path to the executable program to run. The program will be executed with the
            '--latency <value>' option, where '<value>' is the observed wake latency value in
            nanoseconds.
          * trange - the post-trigger range. By default, the trigger program is executed on every
            datapoint. But if the trigger range is provided, the trigger program will be executed
            only when wake latency is in trigger range.
        """

        if not FSHelpers.isexe(path, proc=self._proc):
            raise Error(
                f"post-trigger program '{path}' does not exist{self._proc.hostmsg} or it "
                f"is not an executable file")

        self._post_trigger = path

        if trange is not None:
            vals = Trivial.split_csv_line(trange)

            for idx, val in enumerate(vals):
                if not Trivial.is_int(val):
                    raise Error(
                        f"bad post-trigger range value '{val}', should be an integer "
                        f"amount of nanoseconds")
                vals[idx] = Trivial.str_to_num(val, default=None)
                if vals[idx] < 0:
                    raise Error(
                        f"bad post trigger range value '{vals[idx]}', should be greater or "
                        f"equal to zero")

            if len(vals) != 2:
                raise Error(
                    f"bad post trigger range '{trange}', it should include 2 numbers"
                )
            if vals[1] - vals[0] < 0:
                raise Error(
                    f"bad post trigger range '{trange}', first number cannot be greater "
                    f"than the second number")

            self._post_trigger_range = vals
示例#3
0
    def set_post_trigger(self, path, thresh=None):
        """
        Configure the post-trigger - a program that has to be executed after a datapoint is
        collected. The arguments are as follows.
          * path - path to the executable program to run. The program will be executed with the
            '--latency <value>' option, where '<value>' is the observed latency value in
            nanoseconds.
          * thresh - the post-trigger threshold. By default, the trigger program is executed on evey
            datapoint. But if a threshold is provided, the trigger program will be executed only
            when latency exceeds the threshold.
        """

        if not FSHelpers.isexe(path, proc=self._proc):
            raise Error(
                f"file '{path}' does not exist or it is not an executalbe file"
            )

        self._post_trigger = path
        if thresh is not None:
            if not Trivial.is_int(thresh):
                raise Error(
                    f"bad post-trigger threshold value '{thresh}', should be an integer "
                    f"amount of nanoseconds")
            self._post_trigger_thresh = int(thresh)