char *p = state_path(PERFCOUNTDIR);
/* no registry keys; just create the perfmon directory */
-
+
if ( !directory_exist( p ) )
mkdir( p, 0755 );
-
+
return;
}
if(data.dptr == NULL)
return (uint32)PERF_NO_INSTANCES;
-
+
memset(buf, 0, PERFCOUNT_MAX_LEN);
memcpy(buf, data.dptr, data.dsize);
SAFE_FREE(data.dptr);
{
TDB_CONTEXT *counters;
const char *fname = counters_directory( DATA_DB );
-
+
counters = tdb_open_log(fname, 0, TDB_DEFAULT, O_RDONLY, 0444);
if(counters == NULL)
}
*data = tdb_fetch(counters, key);
-
+
tdb_close(counters);
return True;
DEBUG(3, ("_reg_perfcount_get_counter_info: No counter data for counter [%d].\n", CounterIndex));
return False;
}
-
+
counter_size = _reg_perfcount_get_size_field(obj->counters[obj->NumCounters].CounterType);
if(counter_size == PERF_SIZE_DWORD)
PERF_OBJECT_TYPE *obj;
bool success = True;
char buf[PERFCOUNT_MAX_LEN];
-
+
obj = NULL;
memset(buf, 0, PERFCOUNT_MAX_LEN);
memcpy(buf, data.dptr, data.dsize);
obj->NumCounters += 1;
start = stop + 1;
}
-
+
/* Handle case of Objects/Counters without any counter data, which would suggest
that the required instances are not there yet, so change NumInstances from
PERF_NO_INSTANCES to 0 */
inst->ParentObjectTitlePointer = 0;
inst->UniqueID = PERF_NO_UNIQUE_ID;
inst->NameOffset = 6 * sizeof(uint32);
-
+
inst->ByteLength = inst->NameOffset + inst->NameLength;
/* Need to be aligned on a 64-bit boundary here for counter_data */
if((pad = (inst->ByteLength % 8)))
}
if(obj->instances == NULL)
return False;
-
+
memset(&(obj->instances[instInd]), 0, sizeof(PERF_INSTANCE_DEFINITION));
inst = &(obj->instances[instInd]);
return _reg_perfcount_get_instance_info(inst, ps, instInd, obj, names);
TDB_CONTEXT *counters;
bool status = False;
const char *fname = counters_directory( DATA_DB );
-
+
counters = tdb_open_log(fname, 0, TDB_DEFAULT, O_RDONLY, 0444);
-
+
if(counters == NULL)
{
DEBUG(1, ("reg_perfcount_init_data_block_perf: unable to open [%s].\n", fname));
return False;
}
-
+
status = _reg_perfcount_get_64(&PerfFreq, names, 0, "PerfFreq");
if(status == False)
{
object[obj].HeaderLength = sizeof(*object) - (sizeof(counter) + sizeof(instance) + sizeof(PERF_COUNTER_BLOCK));
object[obj].TotalByteLength += object[obj].HeaderLength;
object[obj].DefinitionLength += object[obj].HeaderLength;
-
+
block->TotalByteLength += object[obj].TotalByteLength;
}
const char *fname = counters_directory( NAMES_DB );
TDB_CONTEXT *names;
int retval = 0;
-
+
names = tdb_open_log(fname, 0, TDB_DEFAULT, O_RDONLY, 0444);
if(names == NULL)
}
reg_perfcount_get_last_counter(base_index);
-
+
if(object_ids == NULL)
{
/* we're getting a request for "Global" here */
prs_debug(ps, depth, "", "_reg_perfcount_marshall_perf_counters");
depth++;
-
+
for(cnt = 0; cnt < object.NumCounters; cnt++)
{
counter = object.counters[cnt];
{
prs_debug(ps, depth, "", "_reg_perfcount_marshall_perf_counter_data");
depth++;
-
+
if(!prs_align_uint64(ps))
return False;
-
+
if(!prs_uint32("ByteLength", ps, depth, &counter_data.ByteLength))
return False;
if(!prs_uint8s(False, "CounterData", ps, depth, counter_data.data, counter_data.ByteLength - sizeof(uint32)))
if(_reg_perfcount_marshall_perf_counter_data(ps, instance.counter_data, depth) == False)
return False;
}
-
+
return True;
}
int obj;
PERF_OBJECT_TYPE object;
-
+
prs_debug(ps, depth, "", "_reg_perfcount_marshall_perf_objects");
depth++;
*/
PERF_DATA_BLOCK block;
uint32 buffer_size, base_index;
-
+
buffer_size = 0;
base_index = reg_perfcount_get_base_index();
ZERO_STRUCT(block);