Records a single snapshot
182382
def rec(self):
        """"""

        try:
            self._snapshot()
        except Exception as e:
            self.log("Timer error: ", e, type(e), lvl=error)
668361
def snapshot(self):
        
        snap = connState(connection_end=self.connection_end,
                         read_or_write=self.row,
                         seq_num=self.seq_num,
                         compression_alg=type(self.compression),
                         ciphersuite=type(self.ciphersuite),
                         tls_version=self.tls_version)
        snap.cipher = self.cipher.snapshot()
        if self.hmac:
            snap.hmac.key = self.hmac.key
        return snap
374416
public EventCounter snapshot(boolean reset) {
		EventCounter s = new EventCounter();
		if (reset) {
			s.count.set(count.getAndSet(0));
		} else {
			s.count.set(count.get());
		}
		return s;
	}
678733
function(thing) {
    if (L.existy(thing) && L.existy(thing.snapshot))
      return thing.snapshot();
    else
      fail("snapshot not currently implemented")
      //return L.snapshot(thing);
  }
1343494
def saveViewSnapshot(self, view):
        '''
        
        '''

        if not view:
            raise ValueError("view must be provided to take snapshot")
        filename = self.snapshotDir + os.sep + '${serialno}-' + view.variableNameFromId() + '-${timestamp}' + '.' + self.snapshotFormat.lower()
        d = FileDialog(self, self.device.substituteDeviceTemplate(filename))
        saveAsFilename = d.askSaveAsFilename()
        if saveAsFilename:
            _format = os.path.splitext(saveAsFilename)[1][1:].upper()
            self.printOperation(view, Operation.VIEW_SNAPSHOT, filename, _format)
            view.writeImageToFile(saveAsFilename, _format)
216186
def make_ops_snapshot( cls, serialized_ops ):
        
        record_hashes = []
        for serialized_op in serialized_ops:
            record_hash = bin_double_sha256( serialized_op ).encode('hex')
            record_hashes.append(record_hash)

        if len(record_hashes) == 0:
            record_hashes.append(bin_double_sha256("").encode('hex'))

        # put records into their own Merkle tree, and mix the root with the consensus hashes.
        record_hashes.sort()
        record_merkle_tree = MerkleTree( record_hashes )
        record_root_hash = record_merkle_tree.root()

        return record_root_hash
553738
function recordTiming (name, timing) {
  recorder[name] = parseInt(timing, 10) || Date.now()
  performanceEvent.trigger('update', getTiming())
}
613937
protected synchronized void snapshotAll() {
        snapshotsManager.getAll().forEach(s -> {
            RepositorySnapshotter.SnapshotIdentifier id = s.prepare();
            s.snapshot(repository.getData(), id);
            s.commit(journalsStorage.getLastStoreVersion(), id);
        });
    }
991714
def snap(self, path=None):
        """"""
        if path is None:
            path = "/tmp"
        else:
            path = path.rstrip("/")
        day_dir = datetime.datetime.now().strftime("%d%m%Y")
        hour_dir = datetime.datetime.now().strftime("%H%M")
        ensure_snapshot_dir(path+"/"+self.cam_id+"/"+day_dir+"/"+hour_dir)
        f_path = "{0}/{1}/{2}/{3}/{4}.jpg".format(
                path,
                self.cam_id,
                day_dir,
                hour_dir,
                datetime.datetime.now().strftime("%S"),
        )

        urllib.urlretrieve(
            'http://{0}/snapshot.cgi?user={1}&pwd={2}'.format(
                                    self.address, 
                                    self.user, 
                                    self.pswd,
                                    ),
            f_path,
        )
314984
private Snapshot createSnapshot(SnapshotDescriptor descriptor) {
    if (storage.level() == StorageLevel.MEMORY) {
      return createMemorySnapshot(descriptor);
    } else {
      return createDiskSnapshot(descriptor);
    }
  }
1100701
def __initialize_snapshot(self):
        
        if not self.__processDict:
            try:
                self.scan_processes()       # remote desktop api (relative fn)
            except Exception:
                self.scan_processes_fast()  # psapi (no filenames)
            self.scan_process_filenames()
1278891
private void startPerformanceSnapshot() {
        // Create new snapshot
        mPerfSnapshot = new Bundle();

        // Add initial binder counts
        Bundle binderCounts = getBinderCounts();
        for (String key : binderCounts.keySet()) {
            mPerfSnapshot.putLong("pre_" + key, binderCounts.getLong(key));
        }

        // Force a GC and zero out the performance counters. Do this
        // before reading initial CPU/wall-clock times so we don't include
        // the cost of this setup in our final metrics.
        startAllocCounting();

        // Record CPU time up to this point, and start timing. Note: this
        // must happen at the end of this method, otherwise the timing will
        // include noise.
        mSnapshotExecTime = SystemClock.uptimeMillis();
        mSnapshotCpuTime = Process.getElapsedCpuTime();
    }
140357
def create_snapshot(self, xml_bytes):
        
        root = XML(xml_bytes)
        snapshot_id = root.findtext("snapshotId")
        volume_id = root.findtext("volumeId")
        status = root.findtext("status")
        start_time = root.findtext("startTime")
        start_time = datetime.strptime(
            start_time[:19], "%Y-%m-%dT%H:%M:%S")
        progress = root.findtext("progress")[:-1]
        progress = float(progress or "0") / 100.
        return model.Snapshot(
            snapshot_id, volume_id, status, start_time, progress)
867797
def snapshot(ctx, board, done):
    
    ctx.obj['board_id'] = board
    ts = TrelloStats(ctx.obj)
    Snapshot.create_table(fail_silently=True)
    done_id = ts.get_list_id_from_name(done)
    ct = cycle_time(ts, board, done)
    env = get_env()
    print render_text(env, **dict(cycle_time=ct))

    # Create snapshot
    print Snapshot.create(board_id=board, done_id=done_id, cycle_time=ct)
568171
def get_snapshot_brok(self, snap_output, exit_status):
        
        data = {
            'uuid': self.uuid,
            'snapshot_output': snap_output,
            'snapshot_time': int(time.time()),
            'snapshot_exit_status': exit_status,
        }
        self.fill_data_brok_from(data, 'check_result')
        return Brok({'type': self.my_type + '_snapshot', 'data': data})
497268
def snapshot_registry(self):
        '''
        
        '''
        unserializer = banana.Unserializer(externalizer=self)
        serializer = banana.Serializer(externalizer=self)
        return unserializer.convert(serializer.convert(self.registry))
814132
def WriteClientSnapshot(self, snapshot, cursor=None):
    """"""
    insert_history_query = (
        "INSERT INTO client_snapshot_history(client_id, timestamp, "
        "client_snapshot) VALUES (%s, FROM_UNIXTIME(%s), %s)")
    insert_startup_query = (
        "INSERT INTO client_startup_history(client_id, timestamp, "
        "startup_info) VALUES(%s, FROM_UNIXTIME(%s), %s)")

    now = rdfvalue.RDFDatetime.Now()

    client_platform = snapshot.knowledge_base.os
    current_timestamp = mysql_utils.RDFDatetimeToTimestamp(now)
    client_info = {
        "last_snapshot_timestamp": current_timestamp,
        "last_startup_timestamp": current_timestamp,
        "last_version_string": snapshot.GetGRRVersionString(),
        "last_platform_release": snapshot.Uname(),
    }
    update_clauses = [
        "last_snapshot_timestamp = FROM_UNIXTIME(%(last_snapshot_timestamp)s)",
        "last_startup_timestamp = FROM_UNIXTIME(%(last_startup_timestamp)s)",
        "last_version_string = %(last_version_string)s",
        "last_platform_release = %(last_platform_release)s",
    ]
    if client_platform:
      client_info["last_platform"] = client_platform
      update_clauses.append("last_platform = %(last_platform)s")

    update_query = (
        "UPDATE clients SET {} WHERE client_id = %(client_id)s".format(
            ", ".join(update_clauses)))

    int_client_id = db_utils.ClientIDToInt(snapshot.client_id)
    client_info["client_id"] = int_client_id

    startup_info = snapshot.startup_info
    snapshot.startup_info = None
    try:
      cursor.execute(
          insert_history_query,
          (int_client_id, current_timestamp, snapshot.SerializeToString()))
      cursor.execute(
          insert_startup_query,
          (int_client_id, current_timestamp, startup_info.SerializeToString()))
      cursor.execute(update_query, client_info)
    except MySQLdb.IntegrityError as e:
      raise db.UnknownClientError(snapshot.client_id, cause=e)
    finally:
      snapshot.startup_info = startup_info