PageRenderTime 18ms CodeModel.GetById 14ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/Core/KSFrameworkStats.h

http://macfuse.googlecode.com/
C++ Header | 85 lines | 27 code | 17 blank | 41 comment | 1 complexity | 709ee8327268cc5992be6becedee2d3e MD5 | raw file
 1// Copyright 2008 Google Inc.
 2//
 3// Licensed under the Apache License, Version 2.0 (the "License");
 4// you may not use this file except in compliance with the License.
 5// You may obtain a copy of the License at
 6//
 7//     http://www.apache.org/licenses/LICENSE-2.0
 8//
 9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#import <Foundation/Foundation.h>
16#import "KSStatsCollection.h"
17
18
19//
20// UpdateEngine Framework Stats keys
21//
22// These keys are for stats recorded by the UpdateEngine framework only. Any 
23// stats specific to the agent, daemon, etc. are not listed here.
24//
25
26#define kStatTickets            @"tickets"
27#define kStatValidTickets       @"validtickets"
28
29#define kStatChecks             @"checks"
30#define kStatFailedChecks       @"failedchecks"
31
32#define kStatPrompts            @"prompts"
33#define kStatPromptApps         @"promptapps"
34#define kStatPromptUpdates      @"promptupdates"
35
36#define kStatDownloads          @"downloads"
37#define kStatDownloadCacheHits  @"downloadcachehits"
38#define kStatFailedDownloads    @"faileddownloads"
39
40//
41// Per-product Stats
42//
43// See "KSMakeProductStatKey()" below for an explanation of using these keys
44//
45#define kStatInstallRC          @"installrc"
46#define kStatActiveProduct      @"active"
47
48// This Macro produces an NSString that is formated with a product ID and the 
49// given stat name. For example, calling
50//
51//   KSMakeProductStatKey(@"foo", kStatInstallRC)
52//
53// would produce the per-product stat key of @"InstallRC/foo"
54//
55#define kProductStatDelimiter @"///"  // Something fairly unique
56#define KSMakeProductStatKey(p, s) \
57  [NSString stringWithFormat:@"%@%@%@", s, kProductStatDelimiter, p]
58
59// Returns YES if the given string represents a per-product stat, NO otherwise
60#define KSIsProductStatKey(key) \
61  ([[key componentsSeparatedByString:kProductStatDelimiter] count] == 2)
62
63// Given a stat key that was created with KSMakeProductStatKey(), return the 
64// product portion of the stat key.
65#define KSProductFromStatKey(key) \
66  [[key componentsSeparatedByString:kProductStatDelimiter] objectAtIndex:1]
67
68// Given a stat key that was created with KSMakeProductStatKey(), return the
69// "stat" portion of the stat key.
70#define KSStatFromStatKey(key) \
71  [[key componentsSeparatedByString:kProductStatDelimiter] objectAtIndex:0]
72
73
74// Provides a global access point to a shared KSStatsCollection object to be
75// used by the UpdateEngine framework for collecting stats.
76@interface KSFrameworkStats : NSObject
77
78// Returns the shared KSStatsCollection instance. May return nil if
79// setSharedStats: was never called.
80+ (KSStatsCollection *)sharedStats;
81
82// Sets the shared KSStatsCollection instance. May set to nil.
83+ (void)setSharedStats:(KSStatsCollection *)stats;
84
85@end