有没有办法获取线程使用哪个内核?
例如
charge = stripe.Charge.get_or_create(
amount = 900,
application_fee = 100,
currency = 'EUR', #TODO Marc source = token,
stripe_account = "XYZ", #TODO Marc: Replace with organizer stripe account
)
new_charge_obj = Charge.objects.get_or_create(
amount = charge.amount, #amount_refunded = charge.amount_refunded,
charge_id = charge.id,
livemode = charge.livemode,
paid = charge.paid,
refunded = charge.refunded,
currency = charge.currency,
failure_code = charge.failure_code,
failure_message = charge.failure_message,
fraud_details = charge.fraud_details,
outcome = charge.outcome,
status = charge.status,
application_fee = charge.application_fee,
captured = charge.captured,
created = charge.created,
)
application_fee = stripe.ApplicationFee.retrieve(charge.application_fee)
Fee.objects.get_or_create(
fee_id = application_fee.id,
livemode = application_fee.livemode,
currency = application_fee.currency,
amount = application_fee.amount,
charge = new_charge_obj,
)
答案 0 :(得分:0)
C ++不提供实现此目的的功能或任何东西,因为该语言没有核心概念。
您可以通过系统调用运行Linux命令来检查以下内容:How can I see which CPU core a thread is running in?
答案 1 :(得分:0)
如果您使用的是基于Linux的系统,则可以使用
sched_getcpu()
打印当前正在运行线程的CPU /内核编号
cout << "Thread running on Core " << sched_getcpu() <<endl