code: public function compute($tag = null, $target = TimePoint::TARGET_ALL, $lastTimestamp = 0)
      {
          // default value for the last timestamp
          if (!$lastTimestamp) {
              $lastTimestamp = microtime(true);
          }
          
          // either get all points or only a subset according to the provided criteria
          if (!$tag && $target == TimePoint::TARGET_ALL) {
              $points = $this->getPoints();
          } else {
              $points = $this->find($tag, $target, TimePoint::TYPE_ALL);
          }
          
          // we need a ordered list of points
          TimePoint::sort($points);
          
          // gather points by ranges, relying on the points references
          $ranges = [];
          foreach ($points as $point) {
              $ranges[$point->getRef()][] = $point;
          }
  
          // compute the total duration by summing all gathered ranges
          // this loop can throw exceptions 
          $duration = 0;
          foreach ($ranges as $range) {
  
              // the last range could be still open, or some range could be malformed due to connection issues...
              $range = $this->fixRange($range, $lastTimestamp);
              
              // compute the duration of the range, an exception may be thrown if the range is malformed
              // possible errors are (but should be avoided by the `fixRange()` method):
              // - unclosed range: should be autoclosed by fixRange
              // - unsorted points or nested/blended ranges: should be corrected by fixRange
              $duration += $this->computeRange($range);
          }
          
          return $duration;
      }
docs: Computes the total duration represented by the filtered TimePoints
  @param string|array $tag A tag or a list of tags to filter
  @param int $target The type of target TimePoint to filter
  @param int $lastTimestamp An optional timestamp that will be utilized to close the last open range, if any
  @return float Returns the total computed duration
  @throws TimeException