public static TrackItemSelect TestAvailableItems(Process p)
                {
                    TrackItemSelect availableItems = TrackItemSelect.None
                                                     | (Utils.ExtensionMethods.TryGet <long?>(() => p.ProcessorAffinity.ToInt64()) != null ? TrackItemSelect.Affinity : TrackItemSelect.None)
                                                     | (Utils.ExtensionMethods.TryGet <int?>(() => p.HandleCount) != null ? TrackItemSelect.HandleCount : TrackItemSelect.None)
                                                     | ((Utils.ExtensionMethods.TryGet <long?>(() => p.VirtualMemorySize64) != null) && (Utils.ExtensionMethods.TryGet <long?>(() => p.PeakVirtualMemorySize64) != null) ? TrackItemSelect.VMSize : TrackItemSelect.None)
                                                     | ((Utils.ExtensionMethods.TryGet <long?>(() => p.WorkingSet64) != null) && (Utils.ExtensionMethods.TryGet <long?>(() => p.PeakWorkingSet64) != null) ? TrackItemSelect.WSSize : TrackItemSelect.None)
                                                     | ((Utils.ExtensionMethods.TryGet <TimeSpan?>(() => p.TotalProcessorTime) != null) && (Utils.ExtensionMethods.TryGet <TimeSpan?>(() => p.UserProcessorTime) != null) ? TrackItemSelect.ProcTime : TrackItemSelect.None)
                    ;

                    if ((availableItems & TrackItemSelect.VMSize) != 0)
                    {
                        if (Utils.ExtensionMethods.TryGet(() => p.VirtualMemorySize64) == 0xffffffff && Utils.ExtensionMethods.TryGet(() => p.PeakVirtualMemorySize64) == 0xffffffff)
                        {
                            availableItems &= ~TrackItemSelect.VMSize;
                        }
                    }
                    return(availableItems);
                }
                public static TrackedValues TryGetFrom(Process p, QpcTimeStamp getTimeStamp, TrackItemSelect trackItemsSelect, TrackedValues prevTrackedValues)
                {
                    TrackedValues result = default(TrackedValues);

                    result.timeStamp = getTimeStamp;
                    if ((trackItemsSelect & TrackItemSelect.Affinity) != 0)
                    {
                        result.affinity = Utils.ExtensionMethods.TryGet(() => unchecked ((UInt64)p.ProcessorAffinity.ToInt64()));
                    }
                    if ((trackItemsSelect & TrackItemSelect.HandleCount) != 0)
                    {
                        result.handleCount = Utils.ExtensionMethods.TryGet(() => p.HandleCount);
                    }
                    if ((trackItemsSelect & TrackItemSelect.VMSize) != 0)
                    {
                        result.virtualMemorySize     = Utils.ExtensionMethods.TryGet(() => unchecked ((UInt64)p.VirtualMemorySize64));
                        result.peakVirtualMemorySize = Utils.ExtensionMethods.TryGet(() => unchecked ((UInt64)p.PeakVirtualMemorySize64));
                    }
                    if ((trackItemsSelect & TrackItemSelect.WSSize) != 0)
                    {
                        result.workingSetSize     = Utils.ExtensionMethods.TryGet(() => unchecked ((UInt64)p.WorkingSet64));
                        result.peakWorkingSetSize = Utils.ExtensionMethods.TryGet(() => unchecked ((UInt64)p.PeakWorkingSet64));
                    }

                    if ((trackItemsSelect & TrackItemSelect.ProcTime) != 0)
                    {
                        result.cpuTime     = Utils.ExtensionMethods.TryGet(() => p.TotalProcessorTime);
                        result.userCpuTime = Utils.ExtensionMethods.TryGet(() => p.UserProcessorTime);

                        double totalElapsedTime        = (getTimeStamp - prevTrackedValues.timeStamp).TotalSeconds;
                        double oneOverTotalElapsedTime = (totalElapsedTime > 0.0) ? (1.0 / totalElapsedTime) : 0.0;

                        double incrementalTotalCPUUsed = (result.cpuTime - prevTrackedValues.cpuTime).TotalSeconds;
                        double incrementalUserCPUUsed  = (result.userCpuTime - prevTrackedValues.userCpuTime).TotalSeconds;

                        result.cpuPerEst     = (float)(incrementalTotalCPUUsed * oneOverTotalElapsedTime * 100.0);
                        result.userCpuPerEst = (float)(incrementalUserCPUUsed * oneOverTotalElapsedTime * 100.0);
                    }

                    return(result);
                }