RepositoryGetCounter Method
|
Get a named Perforce counter value from the repository.
Namespace:
Perforce.P4
Assembly:
p4api.net (in p4api.net.dll) Version: 2024.1.265.5426
Syntax public Counter GetCounter(
string name,
Options options
)
Public Function GetCounter (
name As String,
options As Options
) As Counter
public:
Counter^ GetCounter(
String^ name,
Options^ options
)
member GetCounter :
name : string *
options : Options -> Counter
Parameters
- name
- Type: SystemString
- options
- Type: Perforce.P4Options
Return Value
Type:
CounterRemarks
p4 help counter
counter -- Display, set, or delete a counter
p4 counter name
p4 counter [-f] name value
p4 counter [-f] -d name
p4 counter [-f] -i name
p4 counter [-f] -m [ pair list ]
The first form displays the value of the specified counter.
The second form sets the counter to the specified value.
The third form deletes the counter. This option usually has the
same effect as setting the counter to 0.
The -f flag sets or deletes counters used by Perforce, which are
listed by 'p4 help counters'. Important: Never set the 'change'
counter to a value that is lower than its current value.
The -i flag increments a counter by 1 and returns the new value.
This option is used instead of a value argument and can only be
used with numeric counters.
The fifth form allows multiple operations in one command.
With this, the list is pairs of arguments. Each pair is either
counter value or '-' counter. To set a counter use a name and value.
To delete a counter use a '-' followed by the name.
Counters can be assigned textual values as well as numeric ones,
despite the name 'counter'.
'p4 counter' requires 'review' access granted by 'p4 protect'.
The -f flag requires that the user be an operator or have 'super'
access.
Examples
To get the job counter:
Counter target = Repository.GetCounter("job", null);
To get the change counter:
Counter target = Repository.GetCounter("change", null);
To get the journal counter:
Counter target = Repository.GetCounter("journal", null);
See Also