Я получил его для вставки данных в ячейки с данными и переменными.
<?php
$uploadDir = 'pics/';
if(isset( Я получил его для вставки данных в ячейки с данными и переменными.
[110]POST['upload'])){
$fileName = Я получил его для вставки данных в ячейки с данными и переменными.
[110]FILES['monitor1']['name'];
$tmpName = Я получил его для вставки данных в ячейки с данными и переменными.
[110]FILES['monitor1']['tmp_name'];
$fileSize = Я получил его для вставки данных в ячейки с данными и переменными.
[110]FILES['monitor1']['size'];
$fileType = Я получил его для вставки данных в ячейки с данными и переменными.
[110]FILES['monitor1']['type'];
$filePath = $uploadDir . $fileName;
$result = move_uploaded_file($tmpName, $filePath);
if (!$result) {
echo "Error uploading <strong>file</strong>";
exit;
}
$sql = "INSERT INTO agents(fname,lname,employee_status,dl1,ul1,lat1,jit1,monitor1) "
. " VALUES('". Я получил его для вставки данных в ячейки с данными и переменными.
[110]POST['fname']."',
'" . Я получил его для вставки данных в ячейки с данными и переменными.
[110]POST['lname']."',
'" . Я получил его для вставки данных в ячейки с данными и переменными.
[110]POST['status']."',
'" . Я получил его для вставки данных в ячейки с данными и переменными.
[110]POST['dl1']."',
'" . Я получил его для вставки данных в ячейки с данными и переменными.
[110]POST['ul1']."',
'" . Я получил его для вставки данных в ячейки с данными и переменными.
[110]POST['lat1']."',
'" . Я получил его для вставки данных в ячейки с данными и переменными.
[110]POST['jit1']."',
'" . Я получил его для вставки данных в ячейки с данными и переменными.
[110]FILES['monitor1']."')";
$result = sqlsrv_query($conn,$sql);
if( $result === false ) {
die( print_r( sqlsrv_errors(), true));
}
}
?>
You need to look at the IOKit APIs. The IORegistryExplorer application (part of the standard devtools installation) will help you locate what you're looking for.
For instance, on my MacBook Pro, in IORegistryExplorer I select 'IODeviceTree' from the pull-down at the top-left of the window, and I can see two CPUs in the tree view below. Selecting either one gets me the following information:
IORegistryExplorer screenshot http://blog.alanquatermain.net/images/IORegistryExplorer-CPUs.png
'bus-frequency' and 'clock-frequency', and 'timebase-frequency' are all 32-bit integers wrapper in data objects, and must therefore be byte-swapped to interpret here (little-endian i386 machine words), and work out to the following values:
If you're reading these via IOKit however, you'll get back a CFDataRef, and can just copy the bytes into your own uint32_t like so:
uint32_t bus_frequency = 0;
CFDataGetBytes( theData, (UInt8 *) &bus_frequency, sizeof(uint32_t) );
Next, you can get processor info using the NXArchInfo()
call obtained by including
. This will return a structure containing cpu type and subtype codes along with C-string names and descriptions. If that doesn't include a stepping ID, the only way I can think of to obtain that (off the top of my head) is via the CPUID instruction. Create a .s and .h file, and put in the following code:
.s file:
#ifdef __i386__ || __x86_64__
.macro ENTRY
.text
.private_extern $0
.align 4, 0x90
$0:
.endmacro
// __private_extern__ unsigned long GetCPUSteppingID( void )
ENTRY _GetCPUSteppingID
push %ebp // store existing frame pointer
mov %esp,%ebp // make a new frame pointer from stack pointer
#if __x86_64__
push %rbx
#endif
push %ebx // we save %ebx because the cpuid instruction
// will overwrite it, and it's expected
// to be unchanged in the caller after
// calling another function
movl $1,%eax // fetch cpu info
cpuid // stepping-id is in low 4 bits of %edx now
and $0x0000000f,%edx // clear out everything we don't want
#if __x86_64__
mov %edx,%rax // %rax is 64-bit arch result register
#else
mov %edx,%eax // %eax is 32-bit arch result register
#endif
pop %ebx // restore saved value of %ebx
#if __x86_64__
pop %rbx // restore saved value of %rbx
#endif
leave // restores prior stack frame from %ebp
ret // returns to caller
#endif // __i386__ || __x86_64__
.h file:
#ifndef __GET_STEPPING_ID__
#define __GET_STEPPING_ID__
/* unsigned long is register-sized on both 32-bit and 64-bit OS X */
__private_extern__ unsigned long GetSteppingID( void );
#endif /* __GET_STEPPING_ID__ */
Please note that I'm not certain about the x86_64 bit above; in theory what I've typed there will ensure that the same code compiles for 64-bit, and will return a 64-bit value in that case. It will also save/restore the %rbx register, the 64-bit version of the %ebx register. Theoretically that will cover all bases.
sysctl (3)
, вероятно, хорошее место для начала. Вы, вероятно, захотите, чтобы элементы определялись селекторами CTL_HW
.
Если вам нужна конкретная информация о процессоре, используйте инструкцию cpuid (в C __asm cpuid). Он предоставляет всю возможную информацию о процессоре, включая его семейство, модель, компанию, количество ядер и т. Д. В основном все API используют эту инструкцию для получения информации о процессоре. Вы можете получить подробную информацию о CPUID в Интернете, включая примеры кода и руководства.
Используйте sysctlbyname
вместо sysctl
, например
#include <stdio.h>
#include <stdint.h>
#include <sys/types.h>
#include <sys/sysctl.h>
uint64_t get_cpu_freq(void)
{
uint64_t freq = 0;
size_t size = sizeof(freq);
if (sysctlbyname("hw.cpufrequency", &freq, &size, NULL, 0) < 0)
{
perror("sysctl");
}
return freq;
}
Вы можете получить список имен, которые можно передать в systctlbyname
, посмотрев на вывод sysctl -a
из командной строки.