Пример #1
0
        public static ContentFingerprint ComputeGraphSemistableFingerprint(
            LoggingContext loggingContext,
            PipTable pipTable,
            PathTable pathTable)
        {
            var processSemistableHashes = pipTable.StableKeys
                                          .Select(pipId => pipTable.GetMutable(pipId))
                                          .Where(info => info.PipType == PipType.Process)
                                          .Select(info => info.SemiStableHash)
                                          .ToList();

            processSemistableHashes.Sort();

            var indicatorHashes = processSemistableHashes.Take(16).ToArray();

            using (var hasher = new HashingHelper(pathTable, recordFingerprintString: false))
            {
                hasher.Add("Type", "GraphSemistableFingerprint");

                foreach (var indicatorHash in indicatorHashes)
                {
                    hasher.Add("IndicatorPipSemistableHash", indicatorHash);
                }

                var fingerprint = new ContentFingerprint(hasher.GenerateHash());
                Logger.Log.PerformanceDataCacheTrace(loggingContext, I($"Computed graph semistable fingerprint: {fingerprint}"));
                return(fingerprint);
            }
        }