/// <summary>
        ///     Intializes required resources
        /// </summary>
        private void InitializeImpl()
        {
            var tookLock = false;

            try
            {
                Monitor.Enter(InstanceLockObject, ref tookLock);

                if (!_initialized)
                {
                    if (CategoryName == string.Empty)
                    {
                        throw new InvalidOperationException(SR.Format(SR.CategoryNameMissing));
                    }
                    if (CounterName == string.Empty)
                    {
                        throw new InvalidOperationException(SR.Format(SR.CounterNameMissing));
                    }

                    if (!PerformanceCounterLib.CounterExists(CategoryName, CounterName))
                    {
                        throw new InvalidOperationException(SR.Format(SR.CounterExists, CategoryName, CounterName));
                    }

                    var categoryType = PerformanceCounterLib.GetCategoryType(CategoryName);
                    if (categoryType == PerformanceCounterCategoryType.MultiInstance)
                    {
                        if (string.IsNullOrEmpty(InstanceName))
                        {
                            throw new InvalidOperationException(SR.Format(SR.MultiInstanceOnly, CategoryName));
                        }
                    }
                    else if (categoryType == PerformanceCounterCategoryType.SingleInstance)
                    {
                        if (!string.IsNullOrEmpty(InstanceName))
                        {
                            throw new InvalidOperationException(SR.Format(SR.SingleInstanceOnly, CategoryName));
                        }
                    }

                    if (_instanceLifetime != PerformanceCounterInstanceLifetime.Global)
                    {
                        throw new InvalidOperationException(SR.Format(SR.InstanceLifetimeProcessonReadOnly));
                    }

                    _initialized = true;
                }
            }
            finally
            {
                if (tookLock)
                {
                    Monitor.Exit(InstanceLockObject);
                }
            }
        }